Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Loading spring context as separate task

On 3/4/21 11:39 AM, Tarun Sharma wrote:
> Hi All,
> I have a webapp on jetty which uses spring beans. I am using the listener class of type 'ContextLoaderListener' to initialize the spring context and then invoke some "startup action" on the beans. This "startup action" is taking long on some occasions leading to delayed webapp startup. Is there a way to move this action out of webapplication deployment so that my web application is available quickly?

Nothing out of the box AFAICT. I solved this some time ago using a
separate handler that answers incoming requests while the real app
context starts up in a separate thread. When the real context is ready
the temporary handler is deregistered.

See my demo code here
https://github.com/dirk-olmes/jetty-delayed-context-startup/tree/deferred_context_startup

HTH,

-dirk


Back to the top