EJB 3.1 有状态和 CDI 范围对话
我有一个 @Stateful
EJB,注释为 @ConversationScoped
。客户端 (JSF) 向我的 EJB 发出请求,该请求:启动对话 - conversation.begin()
,执行某些操作并向客户端显示响应。
然后,客户端发出另一个请求,EJB 执行某些操作并关闭对话 - conversation.end()
。
对话结束后,@Stateful
EJB 是否被删除?或者我是否必须显式调用@Remove
?
I have a @Stateful
EJB annotated as @ConversationScoped
. The client (JSF) makes a request to my EJB which: starts the conversation - conversation.begin()
, do something and shows the response to the client.
The client then makes another request, the EJB does something and closes the conversation - conversation.end()
.
Is the @Stateful
EJB removed after the conversation end? Or do I have to explicitly call @Remove
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CDI 规范规定,当创建或销毁作用域时,会自动创建和销毁作用域 EJB。 Conversation 范围也是如此。因此,您不应尝试调用 @Remove 方法。
http://docs.jboss.org/cdi/spec/1.0 /html/concepts.html#d0e1066
The CDI specs say that the scoped EJBs are automatically created and destroyed when the scope is created or destroyed. The same is true for the Conversation scope. So, you should not try to call a @Remove method.
http://docs.jboss.org/cdi/spec/1.0/html/concepts.html#d0e1066