I was wondering because I came across a peculiar behavior with ApplicationScoped
managed beans and a class with a
static {
//some code that accesses an application bean
}
section in it that extends an ApplicationScoped
bean
I am using JSF 2.1.17 with Tomcat 7.
That's just bad design in first place. Application scoped beans are not static, they are just application scoped.
Inject the one as a @ManagedProperty
of the other and perform the job in @PostConstruct
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.