Java 发现以元素';开头的内容无效;全局方法安全性';
在下面的代码中,我得到一个类似于“cvc复杂类型.2.4.a:发现以元素“全局方法安全性”开头的无效内容”的错误 “{”:导入,” bean“:别名“”:bean,WC[##其他:”http:// www.springframework.org/schema/beans“],“:beans}”是 预料之中。” 如何修复它Java 发现以元素';开头的内容无效;全局方法安全性';,java,spring,spring-security,Java,Spring,Spring Security,在下面的代码中,我得到一个类似于“cvc复杂类型.2.4.a:发现以元素“全局方法安全性”开头的无效内容”的错误 “{”:导入,” bean“:别名“”:bean,WC[##其他:”http:// www.springframework.org/schema/beans“],“:beans}”是 预料之中。” 如何修复它 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframewor
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<context:component-scan base-package="client.security"/>
<global-method-security secured-annotations="enabled" />
</beans>
更换
"<global-method-security secured-annotations="enabled" />" line with
<security:global-method-security secured-annotations="enabled"/>
“”与
它应该可以工作。您的根命名空间是
bean
而不是security
。在其前面加上安全性: