How to add custom ApplicationContextInitializer to a spring boot application?

前端 未结 2 1026
我寻月下人不归
我寻月下人不归 2020-12-14 19:12

One way to add custom ApplicationContextInitializer to spring web application is to add it in the web.xml file as shown below.


    <         


        
2条回答
  •  死守一世寂寞
    2020-12-14 19:35

    Another approach is to use context.initializer.classes=com.example.YourInitializer in a properties/yml file. I like this approach because then you can enable/disable initializers via environment specific props files.

    It is mentioned only briefly in the spring boot docs

提交回复
热议问题