Is it possible to set conversation timeout globally for all conversation objects injected into @Named beans?
I have several @ConversationScoped beans, e.g.:
import javax.annotation.PostConstruct;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;
@Named
@ConversationScoped
public class SomeBean1 {
@Inject
private Conversation conversation;
@PostConstruct
private void init() {
if (conversation.isTransient()) {
conversation.begin();
}
}
}
@Named
@ConversationScoped
public class SomeBean2 {
@Inject
private Conversation conversation;
@PostConstruct
private void init() {
if (conversation.isTransient()) {
conversation.begin();
}
}
}
The default timeout for these conversations is 600000 ms. I want to know if there is any way to set conversations' timeouts globally or I need to set it in each bean by
if (!conversation.isTrainsient()) {
conversation.setTimeout(MY_CUSTOM_TIMEOUT);
}
(the problem is that there is a lot of CDI beans and setting timeout manually in each of them is not the best solution)