Does spring (spring mvc) have an event that gets fired once, on application startup, where I can hook in and load some objects?
Does spring (spring mvc) have an event that gets fired once, on application startup,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Can’t you just use the normal initialization mechanisms of a singleton bean, e.g.
@PostConstructorInitializingBean? A singleton bean will only be created/initialized once at context startup.Alternatively, you can implement the
Lifecycleinterface, which gets callbacks from Spring when the context itself start up or shuts down, rather than the bean itself.