我是 Spring 3 的新手。我不知道如何在 Spring 中修复这个命名空间错误security.xml
。实际上我想在 bean 周围添加配置文件代码,所以每当我添加
<beans:beans profile="dev">
在任何 bean 周围,它都会引发以下错误: 在此行找到多个注释:-cvc-complex-type.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>