据我所知,JSF将所有会话范围的bean保存在某种Map中(如果我错了,请纠正)。 在我的应用程序中,我有一个名为“userDetailsBean”的会话作用域bean(由Spring管理并注入到后备bean中)。通过JSF API能否获取创建给不同用户使用的该bean实例的集合?
在@PostConstruct和@PreDestroy期间,将它们添加到/从某个应用程序范围的集合/映射中。@PostConstruct public void init() { allSessionScopedBeans.add(this); } @PreDestroy public void destroy() { allSessionScopedBeans.remove(this); }