My project uses JSF2.0 and CDI. For one page, I want my bean support to match the page life span. @ViewScoped looks perfect, but it is not part of the CDI, and then makes our solution consistent. Then my next option would be CDI @ConversationScoped. It seems the only way to mark the border of the conversation is through the program path through chat.begin and chat.end (I used Seam 2.x, there you can use annotations to mark the border of the conversation). My page sits in a general layout with global navigation, which means there are "unlimited" ways to leave my page. How can I make sure that the conversation is completed depending on which user can choose (for example, by clicking on the global navigation option, which is completely out of my control of the bean)? And I hope that the solution does not extend the code to other modules; and if this is inevitable, I hope that this can be implemented in a cross-cutting manner (AOP).
source share