Search code examples
cdijboss-weld

CDI / Weld: Disable late initialization / call of @PostConstruct


I have a CDI / Weld application running with Hibernate and JSF 2 inside Jetty.

I need to do some initialization after Jetty server is started. I do it in a @PostConstruct method on an @ApplicationScoped bean, but it is not called until a request is sent to the application. I cannot wait for that.

I tried to find out if there is any way to hook into application lifecycle through Weld, but I could not find anything.

Can anybody help me with this please?


Solution

  • To note for whoever might stumble upon this question. I couldn't make it work, and ended up writing my own singletons to deal with situation.