《Spring实战》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be fou

在Eclipse中新建了一个maven项目学习Spring,在 service.xml 中配置 Spring,想要学习‘面向切面的Spring’,service.xml 内容以下:spring

<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:aop="http://www.springframework.org/shema/aop"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:c="http://www.springframework.org/schema/c"
    xsi:schemaLocation="
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        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.xsd
        ">
   <bean id="audience" class="proxy.Audience" />
   <aop:config>
        <aop:aspect ref="audience">
            <aop:around
                pointcut="execution(** concert.Performance.perform(..))"
                method="watchPerformance(ProceedingJoinPoint)" />
        </aop:aspect>
   </aop:config>
</beans>

结果写 <aop: ** > 的时候,没有代码提示,并且老是出现错误提示:maven

Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element
'aop:config'.学习

如图所示:
this

网上搜索解决方案,看到相似的问题是 xsi:schemaLocation 中的 url 没有配置好。思来想去,多是由于本身在 <beans > 中的url没有写正确,就Ctrl+F 搜索‘http://www.springframework.org/schema/’,匹配的字符串就会背景高亮显示。发现果真是由于 “xmlns:aop="http://www.springframework.org/shema/aop" 没有写正确 --- shema 应该是 schema
改正之后就行了。ヾ(@^▽^@)ノurl

相关文章
相关标签/搜索