gpt4 book ai didi

spring - org.xml.sax.SAXParseException : The matching wildcard is strict, 但找不到元素 'aop:config' 的声明

转载 作者:行者123 更新时间:2023-12-05 07:51:25 28 4
gpt4 key购买 nike

我是一个新手,在 Craig Wall 的 Spring in Action 第 4 版中完成我的第一个主要基于 JAVA Spring 应用程序的示例,但我被这个错误困住了......

错误:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 20 in XML document from class path resource [Knights.xml] is invalid;nested exception is org.xml.sax.SAXParseException; lineNumber: 20;columnNumber: 14; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.

My application works as I would expect without the <aop:config> tag in the XML file.

The XML file in question ...

<?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:aop="http://springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="knight" class="knights.BraveKnight">
<constructor-arg ref="quest" />
</bean>
<bean id="quest" class="quests.SlayDragonQuest">
<constructor-arg value="#(T(System).out)" />
</bean>
<bean id="minstrel" class="epic.Minstrel">
<constructor-arg value="#(T(System).out" />
</bean>

<aop:config>
<aop:aspect ref="minstrel">
<aop:pointcut id="embark" expression="execution(* *.embarkOnQuest(..))" />

<aop:before pointcut-ref="embark" method="singBeforeQuest" />

<aop:after pointcut-ref="embark" method="singAfterQuest" />
</aop:aspect>
</aop:config>
</beans>

如果有任何建议,我将不胜感激。谢谢。

最佳答案

尝试将 www 添加到命名空间元素:xmlns:aop="http://www.springframework.org/schema/aop"

关于spring - org.xml.sax.SAXParseException : The matching wildcard is strict, 但找不到元素 'aop:config' 的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35106367/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com