The so-called facet instantiation model refers to when a slice is instantiated.
Spring AOP supports AspectJ's Singleton, Perthis, and Pertarget instantiation models (Percflow, Percflowbelow, and Pertypewithin are not currently supported).
- Singleton : that is, there will only be one instance of the slice;
- Perthis : an AOP object that corresponds to a connection point that matches each pointcut expression creates a new slice instance;
- Pertarget : The target object of the connection point corresponding to each pointcut expression will create a new slice instance;
The default is the singleton instantiation model, which supports only the singleton instantiation model, while the @aspectj style supports these three instantiation models.
Singleton : using @aspect () specifies that the default is singleton instantiation mode, where the example is not shown.
Perthis : an AOP object corresponding to a connection point that matches each pointcut expression creates a new slice instance that specifies the pointcut expression using @aspect ("perthis (pointcut expression)").
such as @Aspect ("Perthis (Cn.javass.spring.chapter6.service.IIntroductionService)") will match each "this" ( Cn.javass.spring.chapter6.service.IIntroductionService) "The AOP proxy object of the Pointcut expression creates a facet instance, noting that" Iintroductionservice "may be the introduction of an interface.
Pertarget : the target object for each connection point that matches each pointcut expression creates a new slice instance that specifies the pointcut expression using @aspect ("Pertarget (pointcut expression)").
such as @aspect ("Pertarget" (Target (CN.JAVASS.SPRING.CHAPTER6). Service. Ipointcutservice) ") will match" target (Cn.javass.spring.chapter6.service) for each Ipointcutservice) "The target object of the Pointcut expression creates a slice, noting that" ipointcutservice "cannot be an introduction interface.
the tangent scope definition must be defined as "prototype", such as "<bean class=" ... Aspect "scope=" prototype "/>", otherwise you cannot create a slice for each matching connection point's target object or AOP proxy object.
Open-Tao Spring3 (6.8)-AOP 6.8 facet instantiation Model