java - Spring AOP - Pointcuts not triggering -
I'm just starting with Spring AOP in my project and there are some problems in spring AOP working properly I have been
I have two objects, transport imple and assassian impulse, which I would like to profess through AOP. Both objects are started through the spring. The implementation of both Beans Professional Interface (Transportation and Session). I can get the applicable aspect on transport imple bean to work well, but the applications applied to session IPLP are not only in the fire. I can confirm that the "MySession Monitor" aspect by Spring initially started , And that the session Impl object has also been started without any exceptions or errors.
I have snatched my point cut and aspect from the most fundamental way. I expected PointCut session operation is described below when session Impl bean is started and init- Method is called initialization. But it never happens, what can be wrong here?
From the configuration file:
& lt; Bean id = "mytransport" class = "my.app.transport.TransportImpl" scope = "singleton" /> & Lt; Bean id = "mysation" class = "my.app.session.SessionImpl" init-method = "initialise" scope = "singleton" /> & Lt; Aop: aspectj-autoproxy proxy-target-square = "true" & gt; & Lt; Aop: Include name = "myTransportMonitor" /> & Lt; Aop: include name = "mySessionMonitor" /> & Lt; / Aop: AspectJ-autoproxy & gt; & Lt; Bean id = "myTransportMonitor" class = "my.app.aspects.TransportMonitoringAspect" /> & Lt; Bean id = "MySpace Monitor" class = "my.app.aspects.SessionMonitoringAspect" />
Aspect code
// Detected monitoring code @ Official public class session monitoring Monitoring {private logger file} logger = logger. Tag ("mylogger"); Public Zero Start () {fileLogger.info ("Session Monitoring Detention"); } @ Pointecut ("Execution (public * * (..)" Any private operation with private zeros () {} @Pointcut ("inside (my.app.session .. *)") in private session (zero) } @PointTit ("Any People Operation () & amp; amp; and InSession ()") Private Zero Session Operation () {@ @ ("session Operation ()") Public Zero Saturation Operation (JoypointPop) {fileLogger .info ("session detected - signature:" + Jp.getSignature ());}}
I personally fold the aspect into the application context I like to keep the control configuration, and you are missing in the referee: Aspect.
Been id = "mySessionMonitor" class = "my.app.aspects.SessionMonitoringAspect" /> & gt; ; Aop: config proxy-target-class = "true"> & lt; / aop: Aspect & Gt; & Lt; / Aop: config & gt;
Comments
Post a Comment