Hi
this is my first question on stack overflow, so please be kind.
i am running an app with
- spring 2.5.x
- Configurable Annotations
- Compile time weaving (CTW)
- maven
- eclipse/ajdt
I use CTW and everything runs fine. But if i instantiate an annotated class for the first time it takes very long. the second time it is very fast.
Looking at the profiler stack trace for the first call i saw 93% of the time is used by org.aspectj.weaver.internal.tools.PointcutExpressionImpl.matchesMethodExecution(Method)
In the stack trace of the second call only 1% of the time is used in this method. Even worse: first call takes about 10 times as long as the second call.
I was wondering as i thought a weaver is no longer needed with CTW.
But it seems that Spring starts analyzing the prototyped bean only as soon as someone calls new on this class. It uses aspectj weaver to analyze what needs to be done and prepares itself to speed up this process for the next call.
Does anybody has any experience with speeding up the first call of initializing an annotated class?
this is a snippet of my pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<configuration>
<verbose>true</verbose>
<complianceLevel>1.5</complianceLevel>
<source>1.5</source>
<showWeaveInfo>true</showWeaveInfo>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>