我注册了一个Spring ApplicationListener bean来监听ContextRefreshed事件.但是出于一些奇怪的原因,我在完成上下文初始化时得到了对该方法的两次调用onApplicationEvent(ContextRefreshedEvent).这是正常行为还是表示我的配置有问题?我正在使用Jetty 8作为我的Servlet容器.
我的相关web.xml配置如下
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/spring/spring-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet-mapping>
<servlet-name>Spring</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
谢谢!