Removing beans from session

前端 未结 1 1399
逝去的感伤
逝去的感伤 2021-01-22 12:36

I have some @SessionScoped CDI beans. Previously all of them were JSF managed beans (changed from JSF managed beans to CDI managed beans).

I was doing like

1条回答
  •  独厮守ぢ
    2021-01-22 13:24

    CDI 1.1 introduced an AlterableContext interface with a destroy(Bean) method.

    Get the session context via beanManager.getContext(SessionScoped.class), downcast to AlterableContext and then invoke destroy() with the appropriate bean type.

    0 讨论(0)
提交回复
热议问题