2013-01-06 137 views
0

我是Spring 3的新手。我不知道如何修復Spring security.xml中的這個命名空間錯誤。其實我綁到周圍添加一個bean配置文件的代碼,所以每當我添加Spring3命名空間錯誤

<beans:beans profile="dev"> 

周圍的任何豆,它引發以下錯誤: - CVC - 複合型: 在這條線找到多個註釋。 2.4.a:從元素'context:component-scan'開始找到無效的內容。 '{「http://www.springframework.org/schema/beans":beans}'之一是 預計。 - 由org.springframework.transaction.interceptor.TransactionInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)

這裏建議是.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:context="http://www.springframework.org/schema/context" 
    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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 
        http://www.springframework.org/schema/security 
        http://www.springframework.org/schema/security/spring-security-3.1.xsd"> 


    <beans:beans profile="dev"> **(This is code that generates error)** 
    <beans:bean id="loggerListener" class="org.springframework.security.authentication.event.LoggerListener"/> 
    </beans:bean> 

回答

0

使用此

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


    <beans:beans profile="dev"> 
    <beans:bean id="loggerListener" class="org.springframework.security.authentication.event.LoggerListener"/> 
    </beans:bean> 

</beans>