從類路徑資源的XML文檔中的第13行[ApplicationContextAOP.xml]無效;嵌套異常是org.xml.sax.SAXParseException:cvc-complex-type.2.4.c:匹配的通配符是嚴格的,但是對於元素'aop:config'沒有聲明。Spring AOP匹配通配符嚴格,但是對於元素'aop:config'沒有聲明可以找到
<?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://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="audience" class="com.idol.Audience" />
<aop:config>
<aop:aspect ref="audience">
<!-- Before performance -->
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))"
method="takeSeats"/>
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))"
method="turnOffCellPhones" />
<!-- After performance -->
<aop:after-returning pointcut="execution(*com.idol.performers.Performer.perform(..))"
method="applaud" />
<!-- After bad performance(exception thrown) -->
<aop:after-throwing pointcut="execution(*com.idol.performers.Performer.perform(..))"
method="demandRefund" />
</aop:aspect>
</aop:config>
<bean id="poeticDuke" class="com.idol.performers.PoeticJuggler">
<constructor-arg value = "15" />
<constructor-arg ref = "sonnet29" />
</bean>
</beans>
我已經看到了類似的錯誤,我敢肯定我的類路徑有org.springframework.aop-3.1.0.M2.jar
你能告訴我什麼,請上午我錯過了?
非常感謝您的提問。我面臨同樣的問題,但在我的情況下,問題是我缺少classpath中的'spring-aop.jar';那是我錯過的。感謝您將此引起我的注意。 – manuelvigarcia