2012-04-29 2 views
1

여기 내 응용 프로그램-security.xml 파일의 바인딩되지 않습니다오류 : 요소의 접두사 "보안" "보안 : 인증 공급자"

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    - Sample namespace-based configuration 
    - 
    - $Id: applicationContext-security.xml 3019 2008-05-01 17:51:48Z luke_t $ 
    --> 
<beans:beans xmlns="http://www.springframework.org/schema/security" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:beans="http://www.springframework.org/schema/beans" 
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-3.1.xsd"> 

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

<!-- Don't set any role restrictions on login.jsp --> 
    <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" /> 

    <!-- Restrict access to ALL other pages --> 
    <intercept-url pattern="/**" access="ROLE_USER" /> 
    <intercept-url pattern="/admin/*.html" access="ROLE_ADMIN" /> 
    <intercept-url pattern="/manager/*.html" access="ROLE_MANAGER" /> 
    <intercept-url pattern="/**.html" access="ROLE_USER,ROLE_ADMIN, ROLE_MANAGER" /> 
    <!-- Set the login page and what to do if login fails --> 
    <form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?login_error=1" default-target-url="/user/userdashboard/dashboard.html" /> 
    <logout logout-success-url="/login.jsp"/> 
</http> 

<!-- 
Usernames/Passwords are 
    rod/koala 
    dianne/emu 
    scott/wombat 
    peter/opal 
--> 
    **<security:authentication-provider> 
     <jdbc-user-service data-source-ref="dataSource" /> 
    </security:authentication-provider>** 
</beans:beans> 

모든 것이 잘 작동하지만 "security : authentication-provider"요소에 대한 접두사 "security"가 바인딩되지 않은 이상한 오류가 발생합니다. " 비록 내가 닫는 태그를 제공했다. 이 문제를 해결하는 방법에 대한 단서가있는 사람은 누구입니까?

답변

8

중 하나 proper namespace 사용하여 모든 요소에 대해 "보안"을 사용

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:security="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.3.xsd"> 
    ... 
</beans> 

을 그리고 "보안"사용 그것을 제거 completly

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

또는를 예를 들어 사방을, : 당신은 기본 네임 스페이스를 구성

... 
<authentication-provider> 
     <jdbc-user-service data-source-ref="dataSource" /> 
    </authentication-provider> 
... 

때문에 xmlns="http://www.springframework.org/schema/security"