柰茶 2019-09-21 09:48 采纳率: 50%
浏览 2273

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.

最近做AOP测试,标签一直报错:
图片说明

所报错误信息就是:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.

我已经在xmlns,xsi:schemaLocation.配置aop的约束了,已经namespaces内也勾选上了aop:

图片说明

程序依旧无法识别,该如何解决呢?

  • 写回答

2条回答 默认 最新

  • Json-Huang 2019-09-21 10:21
    关注

    applicationContext.xml中配置有问题,aop:config下的aop:pointcut应该跟aop:aspect是同级别的,应该是兄弟关系,不是父子关系,类似下面

    <aop:config>
            <aop:pointcut id="loggerCutpoint"
                expression=
                "execution(* com.how2java.service.ProductService.*(..)) "/>
    
            <aop:aspect id="logAspect" ref="loggerAspect">
                <aop:after pointcut-ref="loggerCutpoint" method="log"/>
            </aop:aspect>
      </aop:config>
    
    评论

报告相同问题?