2017-01-01 19 views
0

私は例外があります:org.springframework.beans.factory.parsing.BeanDefinitionParsingException:構成問題:XMLスキーマの名前空間の春NamespaceHandlerを見つけることができません[http://www.springframework.org/schema/security] 問題のリソース:のServletContextをリソース[/WEB-INF/spring/security.xml]春のセキュリティ - 春NamespaceHandlerを見つけることができません - セキュリティ

Googleで数分、私に言えば、私は依存性を追加する必要があります - spring-security-config。私はこれを持っています、4.2.1の最新バージョンですが、例外があります。

のsecurity.xml

<?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-4.1.xsd 
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd"> 

<beans:bean name="standartEncrypt" 
      class="org.springframework.security.crypto.password.StandardPasswordEncoder" > 
    <beans:constructor-arg name="secret" value="3u6gui" /> 
</beans:bean> 

<http auto-config="true" > 
    <intercept-url pattern="/notes/**" access="authenticated" /> 
    <intercept-url pattern="/register" requires-channel="https" /> 
    <intercept-url pattern="/" access="permitAll" /> 
    <intercept-url pattern="/accessDenied" access="permitAll" /> 
    <intercept-url pattern="/duplicate" access="permitAll" /> 
    <intercept-url pattern="/notExists" access="permitAll" /> 

    <access-denied-handler error-page="/accessDenied" /> 

    <logout 
      logout-success-url="/index" 
      logout-url="/notes/{username}/exit" 
    /> 
    <form-login 
      authentication-failure-url="/accessDenied" 
      login-page="/register" 
      login-processing-url="/register" 
      password-parameter="password" 
      username-parameter="username" 
    /> 
    <remember-me data-source-ref="dataSource" /> 

    <session-management session-fixation-protection="newSession"> 
     <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" /> 
    </session-management> 
</http> 

<authentication-manager > 
    <authentication-provider> 
     <password-encoder ref="standartEncrypt" /> 
     <jdbc-user-service data-source-ref="dataSource" users-by-username-query="SELECT username, password FROM Users WHERE username = ?"/> 
    </authentication-provider> 
</authentication-manager> 

<global-method-security jsr250-annotations="enabled" secured-annotations="enabled" /> 

のmaven

<dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-config</artifactId> 
    <version>4.2.1.RELEASE</version> 
</dependency> 

答えて

0

これはおそらく、未解決の依存関係です。あなたのMavenのPOMやプロジェクト構成を見ることなく、春のセキュリティのための最低限は次のとおりです。

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

あなたがMaven -> Update Projectを選択し、フルclean installを行い、その後、プロジェクトを右クリックしてください、春のツール・スイートまたはEclipseを使用している場合

関連する問題