如何让spring mvc web应用启动时就执行特定处理

2025-05-20 21:22:29
推荐回答(1个)
回答1:

spring 中ContextLoaderListener监听器的作用就是启动Web容器时,自动装配ApplicationContext的配置信息。你可以自己写个Listener继承这个ContextLoaderListener或者ServletContextListener 以及ApplicationListener,然后实现其中的方法就可以。