I play with Spring AOP.
Here is a simple class
public class CModel extends Car {
private double torqueMeasure = 1;
public CModel() {
System.out.println(" C-Model constructor");
}
}
And Spring configuration is like this
<aop:config>
<aop:aspect ref="audit">
<aop:before pointcut="execution(* com.test.main..*(..))" method="firstControl"/>
...
</aop:aspect>
</aop:config>
It's good now; when I add aop: config and intercept the CModel, then Spring calls the CModel constructor twice. This means that Spring creates 2 CModel objects, right?
If I remove the AOP configuration, then Spring will only create one CModel object.
Any idea why this is?
Thank.
Lurtz source
share