I have some action I need to perform after the entire spring application has finished loading. The action must happen after all beans are inititlized and all controllers can start serving requests.
I tried implementing a ServletContextListener and adding it as a listener in AbstractAnnotationConfigDispatcherServletInitializer but this happens as soon as the application boot up and not after. Also I am not using SpringBoot avaiable to do this.
Thanks,
Because you are using spring mvc.
So RequestHandledEvent will fulfill your requirement.
RequestHandledEvent
This is a web-specific event telling all beans that an HTTP request has been serviced.
More detail about spring event
https://www.tutorialspoint.com/spring/event_handling_in_spring.htm
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.