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


I have one aspect that works correctly in a unit test, a log message is printed by the actual method, And later applied to the aspect.

While running my webpage, I only see the result of applying '@afterReturning' advice, my method does not execute first.

My config:

  & lt; Bem 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"> & Lt; Aop: aspectj-autoproxy proxy-target-square = "true" /> & Lt; Bean id = "Logging Aspect" class = "com.mapackage.myspect" /> & Lt; / Bean & gt; 

">

If the information you provided is not enough to analyze, then below the things in your web app Check,

1) Verify that the method you prevent from your advice is related to the spring bean category; there is no other servlet or other class defined out of spring, If not started through the medium, then that drill can not be advised.

2) Verify that above & amp; topping the proper reference xml for config spring. In case of spring-MVC, you must explicitly define the name of your application reference XML. In the context, you need to write an AOP configuration in XML.

3) Verify that your consultant is suitable for finding the right class; method for advice.

See these things Where


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -