Spring AOP Error

What will cause this problem at runtime ?:

The corresponding template is strict, but the declaration cannot be found for the element 'aop: config'

Here is the relevant Spring XML:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/util
       http://www.springframework.org/schema/util/spring-util-2.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
    .
    .
    .
    <aop:config>
        <aop:advisor pointcut="execution(* acme.exam.driver.ui.components..*(..))" 
                     advice-ref="loggingInterceptor" />
    </aop:config>

    <bean id="loggingInterceptor" 
          class="org.springframework.aop.interceptor.CustomizableTraceInterceptor">
        <property name="enterMessage" 
                  value="ENTER: $[targetClassShortName].$[methodName]($[arguments])" />
        <property name="exitMessage" 
                  value="EXIT: $[targetClassShortName].$[methodName]($[arguments]) = $[returnValue])" />
    </bean>
</beans>

Note that Ive already placed aspectjweaver.jar and aspectjrt.jar in the class path.

+3
source share
3 answers

Have you marked the spring aop artifact twice on your class path?

And according to my maven dependencies, aspectjweaver is not enough, I also need aspect.

+2
source

Be sure to be <spring-framework-directory>/dist/modules/spring-aop.jarin your class path.

0
source

- ,

xmlns:aop="http://www.springframework.org/schema/aop

xsi: schemaLocation

http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd

This configuration error triggered the message above.
Adding elements to the schemaLocation enabled it.

0
source

Source: https://habr.com/ru/post/1708575/


All Articles