I am new to spring MVC. I am looking for a place in my spring mvc applicationwhere I can initialize all sorts of things in the application. usually I did that in the init()
All beans can have an init-method. See the documentation. I suppose that the best practice will be to use this method for every bean you define. A bean can have references to other beans if this is required.
Use a ServletContextListener
and define it in web.xml
:
<listener>
<listener-class>com.company.YourListenerClass</listener-class>
</listener>
(you make a class which implements ServletContextListener
and implement the contextInitialized()
method, where you place your initialization code)