Tuesday, 15 June 2010

aspectj - Spring Boot load time weaving doesn't work in embedded tomcat -


I can not get LTW to work in Spring Boot 1.2.2 W / Embedded Tomcat.

My application is a WAR file, not a .JAR file. When I run in DEBUG, it is never closed in my aspects, which will match the points as well as kill the call, so that's how I am working ... This is my job .... >

My run script does this:

  -javasent: path / to / spring-instrument-xxx.jar-javaagent: path / To / aspectjweaver-1.2.8.jar  

In the spring boot, I load this AOP configuration as an application inchializer, That's why it is immediately in the original applicationcontact and after all, all my embedded Tomcat web applications should be there for the context.

  @EnableLoadTimeWaving (aspectjWeaving = Pascal.NABLE) @configuration public class AOPConfig {Private Log Log = Logfiner Tag (AOPConfig class); Public AOPConfig () {log.info ("Creating AOPConfig"); } @ Bean Public Load Time Waver Load Time Wave () {log.info ("Instrumentation Laud Time Wave"); New Instrumentation Return Time Wave (); }}  

My appearance looks like this:

  package my.aop.profiler.MethodTimerAspect; @ Aspect Public Class Methththimer Aspect {Private Static Finale String DELIMITER = "|"; Private static final string PROFILER = "profiler"; Private Stable Last String DATE_FORMAT = "h: mm: ss"; Private Static Last Log LOG = LogFactory.getLog (PROFILER); Public policy () {} @Pointcut ("execution (* my.web. * Controller. * (..)" protected zero controller () {} @Pointcut ("execution (* my.services .. * mask * ( ..)) "Protected Zero Services () {} @Pointcut (" Execution (* my.services .. * Exchange. * (..)) "Secure Zero Data () {} / ** * if with profiling trace This method is enabled * * @ Ultimate Joint Point * Return Object * Throws throttle * / @Around ("Controller () (services) () (Data)") Public object doProfiling (Pro) ShootingJointPointJointPoint) Throwsable {// (...)}}  

My Embedded War is Meta-INF / AOP.XM:

two thoughts:

  • maybe You want to change one of your pointers to use the sub-package (use . instead of . ):

     @Pointcut ("Execution (* my.web .. * Controller. * (..))")  
  • The same is your Aop.xml :

      & lt; Include = "cdot .. *" />  

I think that my.web was intentionally changed by you and actually cdot.something because otherwise the points do not match.


No comments:

Post a Comment