想通过spring在起动服务后将一些数据放到Application里,有什么好的办法吗?

想通过spring在起动服务后将一些数据放到Application里,有什么好的办法吗?

继承ContextLoaderListener,实现一些自己的功能(就是你说的将一些数据放到Application里)。
然后web.xml里不要放spring的ContextLoaderListener,而是用你自己继承的类代替。

这个和你用不用spring没关系 你只要监听服务启动事件 编写一个监听器 在服务器启动的

时候 执行你的逻辑 就可以了

public class MyListenre implements ContetLoaderListener

web.xml


监听器的完整类名