Java Spring安全配置,此时不需要任何子元素。找到无效内容
我试图通过使用Java Spring安全配置,此时不需要任何子元素。找到无效内容,java,xml,spring,spring-mvc,spring-security,Java,Xml,Spring,Spring Mvc,Spring Security,我试图通过使用ContextLoaderListener在web.xml中添加security config.xml文件,但在尝试为security config.xml添加后,出现错误,错误如下: 发现以元素“param value”开头的无效内容。不 此时需要子元素 JPA配置使用了jpaContext.xml,因此我无法删除它。现在我该怎么办 <listener> <listener-class>org.springframework.web.context.Con
ContextLoaderListener
在web.xml
中添加security config.xml
文件,但在尝试为security config.xml
添加
后,出现错误,错误如下:
发现以元素“param value”开头的无效内容。不
此时需要子元素
JPA配置使用了jpaContext.xml
,因此我无法删除它。现在我该怎么办
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/jpaContext.xml</param-value>
<param-value>/WEB-INF/config/security-config.xml</param-value>
</context-param>
org.springframework.web.context.ContextLoaderListener
上下文配置位置
类路径:/jpaContext.xml
/WEB-INF/config/security-config.xml
ContextLoaderListener
支持具有多个contextConfigLocation
。每个上下文配置文件都应该用空格分隔(新行或空格)。请参见下面的示例:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/jpaContext.xml /WEB-INF/config/security-config.xml</param-value>
</context-param>
上下文配置位置
类路径:/jpaContext.xml/WEB-INF/config/security-config.xml
您遇到的错误是由于在
下有多个
标记造成的。请使用逗号:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/jpaContext.xml, /WEB-INF/config/security-config.xml
</param-value>
</context-param>
上下文配置位置
类路径:/jpaContext.xml,/WEB-INF/config/security-config.xml
您在jpaContext.xml和security-config.xml中都有“数据源”吗?