This is Java EE 6, I need some key beans from the EJB dependency, which is huge. It has a lot of @Startup
beans, a lot of @Schedule
annotations in there which I don't need to be started in my ear. How it could be achieved?
All the session beans / CDI beans in JavaEE are lazily initialized by default. Hence unless a bean is accessed, it won't be started. @Startup
annotation is for @Singleton
session beans to initialize them eagerly.
During startup, the container scans for all the @Schedule
annotations, as such all the timers are created at startup. But the beans which contain the @Schedule
method is only initialized the first time the timer is fired.
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.