3

I have a @ApplicationScoped bean in my Helidon MP microservice, is there a way to force the creation of the bean at server startup instead at first method call?

I need this bean ready and running just after server startup but every attempt I made it's inconclusive

TheOni
  • 810
  • 9
  • 26

1 Answers1

4

I found a way to solve it. If your bean observes the initialization of ApplicationScoped it will be instantiated during startup phase. It's a trick but it works fine.

public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {

}
TheOni
  • 810
  • 9
  • 26