1. 程式人生 > >《Spring實戰》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element' 錯誤的解決

《Spring實戰》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element' 錯誤的解決

tip c-c 面向切面 ng- join proc ima -a edi

在Eclipse中新建了一個maven項目學習Spring,在 service.xml 中配置 Spring,想要學習‘面向切面的Spring’,service.xml 內容如下:

<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: ** > 的時候,沒有代碼提示,而且總是出現錯誤提示:

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‘.

如圖所示:
技術分享圖片

網上搜索解決方案,看到類似的問題是 xsi:schemaLocation 中的 url 沒有配置好。思來想去,可能是因為自己在 <beans > 中的url沒有寫正確,就Ctrl+F 搜索‘http://www.springframework.org/schema/’,匹配的字符串就會背景高亮顯示。發現果然是因為 “xmlns:aop="http://www.springframework.org/shema/aop" 沒有寫正確 --- shema

應該是 schema
改正以後就好了。ヾ(@^▽^@)ノ

《Spring實戰》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element' 錯誤的解決