不多说,直接上代码
<context-param> <param-name>contextConfigLocation </param-name> <param-value>/WEB-INF/spring/AppContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>App</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation </param-name> <param-value>/WEB-INF/spring/AppContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
这样子程序没问题可以跑。但是AppContext.xml加载了两遍。求高手解决下
4 回答
婷婷同学_
TA贡献1844条经验 获得超8个赞
把<context-param>
<param-name>contextConfigLocation </param-name>
<param-value>/WEB-INF/spring/AppContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> 放到 <servlet> </servlet>里试试,然后里面多了一个什么0.0
添加回答
举报
0/150
提交
取消