Why does my AOP Spring aspect work in my unit test, but not in my webapp?

I have an aspect that works correctly in my unit tests, the log message is printed from the actual method, and then from the applied aspect.

When starting my webapp, although, I only see the result of applying "@afterReturning", my method is not executed first.

My configuration:

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

  <aop:aspectj-autoproxy proxy-target-class="true" />

  <bean id="loggingAspect" class="com.mypackage.MyAspect" />

</beans>

Any ideas?

Thank you for your help.

+3
source share
1 answer

The information you provided is not sufficient for analysis. So check what happens in your web application,

1) , , , spring bean, , spring. - spring, aop.

2) , aop tips xml spring. spring -mvc, xml. xml aop.

3) , pointcut .

, .

0

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


All Articles