项目启动之后,我感觉没有加载spring文件,因此注入失败,导致我在action中 ecuserCustomerManager 为空。
我看了一下web.xml中的设置如下:
[code="java"]
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
/WEB-INF/**/spring*.xml
[/code]
但是我的WEB—INF下目录是这样的。
[img]http://dl2.iteye.com/upload/attachment/0099/0490/f43bf47f-be8c-304d-9feb-64d450f409dd.png[/img]
这样写之后 spring-hessian-servlet.xml 可以加载了,但是我的其它的spring.xml并不是放在WEB-INF 下面的,目前是跟src在同一级的。我如何引入其它的spring.xml呢? 现在的文件目录如下:
[img]http://dl2.iteye.com/upload/attachment/0099/0494/5c1f8bad-b4d9-305f-8005-5a29be454cf7.png[/img]
其中spring-hessian-servlet.xml 也没有import之类的语句。
右键resource--Build Path--- Use as Source Folder,
然后在web.xml中加入xiaotqc000 童鞋所说
contextConfigLocation
classpath:config/common/spring*.xml
classpath:manager/customer/spring-*.xml
web.xml中如下:
contextConfigLocation
classpath*:esb/spring/spring-pub.xml,
classpath*:oa/spring/spring-oa.xml,
classpath*:spring_anbpm/spring-anbpm-wf.xml
最简单的 ,把所有子配置文件通过添加到主配置文件中,web.xml加载的时候就加载这一个就行了,context-param写那么多,你不感觉累吗?
[code="java"]
/WEB-INF/**/spring*.xml
classpath:config/common/spring*.xml
classpath:manager/customer/spring-*.xml
[/code]