gpt4 book ai didi

java - 无法读取架构文档 'http://www.springframework.org/schema/security/spring-security-4.0.xsd'

转载 作者:数据小太阳 更新时间:2023-10-29 03:01:34 27 4
gpt4 key购买 nike

我想使用这样配置的 Spring security

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd">

<http>
<intercept-url pattern="/add-job**" access="hasRole('USER')" />
<form-login />
<logout />
</http>

<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>

</beans:beans>

但是我得到的错误是

Multiple annotations found at this line: - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/ security/spring-security-4.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'http'.

我的安全 pom.xml 是

<!-- Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>

我找不到解决这个问题的方法。

最佳答案

感谢回答者,但最后我在 Migrating from Spring Security 3.x to 4.x (XML Configuration) 找到了解决方案, 发现有如下依赖

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>

这与问题中提到的一起,这种方法解决了我的问题。

关于java - 无法读取架构文档 'http://www.springframework.org/schema/security/spring-security-4.0.xsd',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32547157/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com