spring mvc servlet initialization

前端 未结 2 843
有刺的猬
有刺的猬 2020-12-14 13:04

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()

2条回答
  •  醉梦人生
    2020-12-14 13:49

    Use a ServletContextListener and define it in web.xml:

    
        com.company.YourListenerClass
    
    

    (you make a class which implements ServletContextListener and implement the contextInitialized() method, where you place your initialization code)

提交回复
热议问题