Search code examples
authenticationweb-applicationsjetty

Jetty: load a server bean from war before initialization


I have a webapp being loaded from a Jetty server.

I want to load a bean implementing a MappedLoginService inside the webapp (not from the server) before the webapp starts loading.

Is there any way?

I tried to load the bean in the webapp post-construct and in webapp application class (javax.ws.rs.Application), without success.


Solution

  • Put the initialization in the WEB-INF/jetty-web.xml file.

    That will load it during WebApp initialization, before the Servlet layer initialization kicks off.