1.启动服务时通过spring容器的监听器(继承ContextLoaderListener 监听器的方法) public class ListenerSpringContext extends ContextLoaderListener { private final Logger log = LoggerFactory.getLogger(ListenerSpringContext.class); public void contextInitialized(ServletContextEve