Reputation: 589
I was wondering if it is possible to retrieve ALL instances of a given Bean
from the FacesContext
. This includes that beans might be session scoped.
Or do I have to register them somewhere in instatiating and retrieve them again later?
The method from which I want to clal this funktionality will be triggered by a @Schedule
and is for clearing all caches that are held somewhere in the application
Thanks in advance :)
Upvotes: 0
Views: 166
Reputation: 1108642
Or do i have to register them somewhere in instatiating and retrieve them again later?
Yes, you have to.
@PostConstruct
public void init() {
allBeans.add(this);
}
@PreDestroy
public void destroy() {
allBeans.remove(this);
}
allBeans
can be an injected application scoped bean.
Upvotes: 2