According to javadoc , it @ListenerForintends to be included in the implementation UIComponentor Renderer, rather than in a standalone implementation SystemEventListener. For the latter you need to register it as <system-event-listener>in faces-config.xml.
eg.
<application>
<system-event-listener>
<system-event-listener-class>com.example.MySystemEventListener</system-event-listener-class>
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
<system-event-class>javax.faces.event.PreDestroyApplicationEvent</system-event-class>
<system-event-listener>
</application>
For a specific functional requirement, you might want to use the expected initialized bean application instead. This is somewhat simpler and does not require some verbose XML:
@ManagedBean(eager=true)
@ApplicationScoped
public void App {
@PostConstruct
public void init() {
}
@PreDestroy
public void destroy() {
}
}
source
share