只要在web.xml中加入这句
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
就会报错java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext。项目无法启动。
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
就会报错java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext。项目无法启动。
<param-name>contextConfigLocation</param-name>
<!--<param-value>/WEB-INF/applicationContext.xml</param-value>-->
<param-value>classpath:applicationContext*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<!--org.springframework.web.context.ContextLoaderServlet -->
</listener>
<!--contextConfigLocation在 ContextLoaderListener类中的默认值是 /WEB-INF/applicationContext.xml-->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>