我使用Spring Security,但由于某种原因,我的web.xml没有找到我的applicationContext .XML 的web.xmljava.io.FileNotFoundException:无法打开类路径资源[conf/admin/applicationContext.xml],因为它不存在
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:conf/admin/applicationContext.xml
classpath:conf/admin/applicationContext-security.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
我的applicationContext.xml是myProject的/ conf目录/管理/ applicationContext.xml中,在同一个地方作为我的web.xml但它总是抛出异常:
14:18:07,793 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [conf/admin/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [conf/admin/applicationContext.xml] cannot be opened because it does not exist
我试过把WEB-INF文件夹放进去(就像每个Spring Security教程),这是在myProject/dist/web/WEB-INF,但是当我清理我的项目刷新和重建它被删除。
那么我做错了什么?把错误的路径放在contextConfigLocation
或applicationContext.xml中错误的地方?
@StudioWorks如果回答您的问题,请接受此解决方案。 –