当前位置: 首页 > 知识库问答 >
问题:

发现以元素“global-method-security”开头的内容无效

夏侯渊
2023-03-14

在下面的代码中,我得到了这样的错误:“cvc-complex-type.2.4.a:发现从元素'global-method-security'开始的内容无效。”{“http://www.springframework.org/schema/beans”:import,“http://www.springframework.org/schema/beans”:alias,“http://www.springframework.org/schema/beans”:bean,wc[##other:“http://www.springframework.org/schema/beans”]和“http://www.springframework.org/schema/beans”:“beans}”中的一个。“

如何修复?

 <?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>

共有1个答案

壤驷安和
2023-03-14

替换

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

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

应该能行..

 类似资料: