Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring安全配置,此时不需要任何子元素。找到无效内容_Java_Xml_Spring_Spring Mvc_Spring Security - Fatal编程技术网

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中都有“数据源”吗?