我想使用Spring Security所以可以這樣來配置無法讀取模式文檔「http://www.springframework.org/schema/security/spring-security-4.0.xsd」
<?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>
,但我「m到處錯誤,
在這條線找到多個註釋: - schema_reference.4:無法讀取模式文檔」 http://www.springframework.org/schema/ 安全/彈簧安全4.0.xsd」,因爲:1)找不到文件; 2)文件無法閱讀; 3) 該文件的根元素不是。 - cvc-complex-type.2.4.c:匹配通配符是嚴格的,但是對於元素 '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>
我不能找到辦法來解決這個問題。
謝謝,但我的回答解決了我的問題。 –
這很奇怪,正如我告訴你的,我和這兩個依賴關係都有非常相似的項目。我只運行依賴關係樹,並且我看到'spring-security-core'包含'spring-security-web'和'4.0.0.RELEASE'。它以這種方式爲我工作。 – malaguna