CDI 1.1 introduced an AlterableContext
interface with a destroy(Bean<T>)
method.
Get the session context via beanManager.getContext(SessionScoped.class)
, downcast to AlterableContext
and then invoke destroy()
with the appropriate bean type.
More Related Contents:
- How to install and use CDI on Tomcat?
- Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable
- Backing beans (@ManagedBean) or CDI Beans (@Named)?
- Pass an object between @ViewScoped beans without using GET params
- How to upload file using JSF 2.2 ? Where is the saved File?
- Why are there different bean management annotations
- Which XML namespace to use with JSF 2.2 and up
- File upload doesn’t work with AJAX in PrimeFaces 4.0/JSF 2.2.x – javax.servlet.ServletException: The request content-type is not a multipart/form-data
- @ViewScoped bean recreated on every postback request when using JSF 2.2
- When using @EJB, does each managed bean get its own @EJB instance?
- How to replace @ManagedBean / @ViewScope by CDI in JSF 2.0/2.1
- Getting ViewExpiredException in clustered environment while state saving method is set to client and user session is valid
- @javax.faces.bean.ManagedProperty in CDI @Named bean returns null
- How to write a file to resource/images folder of the app?
- Using a “Please select” f:selectItem with null/empty value inside a p:selectOneMenu
- @Inject to pass params to a CDI @Named bean via URL
- Changing faces-config.xml from 2.2 to 2.3 causes javax.el.PropertyNotFoundException: Target Unreachable, identifier ‘bean’ resolved to null
- NullPointerException while trying to access @Inject bean in constructor
- Fileupload and PrettyFaces and JSF 2.2 [duplicate]
- JSF does not populate @Named @RequestScoped bean with submitted input values
- javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL does not work anymore since Java EE 7 / EL 3.0
- JSF: Mojarra vs. OmniFaces @ViewScoped: @PreDestroy called but bean can’t be garbage collected
- Process f:viewParam only on page load
- Populate p:selectOneMenu based on another p:selectOneMenu in each row of a p:dataTable
- How to use enum values in f:selectItem(s)
- Exception handling in JSF ajax requests
- Purpose of the h:outputLabel and its “for” attribute
- How can I set id of a component/tag inside ui:repeat
- JSF 2 and Post/Redirect/Get?
- FacesContext.getCurrentInstance() returns null in Runnable class