我試圖用Web Security Expressions然而,當我在單元測試負載的情況下,我得到org.xml.sax.SAXParseException: The markup declarations contained or pointed to by the document type declaration must be well-formed
彈簧安全的web錯誤加載上下文
我的背景文件看起來像這樣:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security"
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-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
// various beans here
<sec:http use-expressions="true">
<sec:intercept-url pattern="/admin*"
access="hasRole('admin') and hasIpAddress('192.168.1.0/24')"/>
</sec:http>
</beans>
如果我不包括<sec:http>
標籤我沒有得到錯誤。如果我只包含<sec:http/>
,我確實收到錯誤。
在我的POM我已經包括:
<dependancy>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependancy>
您對http://www.springframework.org/schema/security/spring-security-3.0.xsd URL(在執行測試的環境中)有任何問題嗎? –
我得到了404以及我使用的所有其他xsds。我假設它在運行時從jar中獲取模式?不知道如何檢查是否可以找到它與我使用的其他人。 –
這個通常通過網絡加載。我沒有任何問題(可以在我的網頁瀏覽器中查看)。 –