2013-01-06 112 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>