All entries for Friday 13 January 2006
January 13, 2006
Spring AOP
Follow-up to Spring Training from Oracle/Java/Others
Concept
Aspect and Advisor are interchangeable
Pointcut is refinement of join point
Aspect, Join point, Poincut advice are generic and appl to .net as well.
Advisor is specific to Spring
Proxy:
it is just a wrapped target.
It need to associate with Advice/Interceptor and let Advice/Interceptor to let the job
Dynamic proxy:
Every method(defined in the interface) invocation wil go through proxy first
invocation.proceed() = chain.doFilter()
1.explicit creation of AOP proxies:
using a ProxyFactoryBean or similar factory bean
ProxyFactoryBean has properties: P24
1) proxyInterfaces: the interface to proxy
2) target: the target object to be proxyed, which should implemnts interface
3) interceptorNames: the name of advice;they are ORDERED!
2. use "autoproxy" bean definitions
can automatically proxy selected bean definitions:
Two ways to do this:
1) Using an autoproxy creator that refers to specific beans in the current context
BeanNameAutoProxyCreator: beanNames && interceptorNames (be aware of maintenance cost)
DefaultAdvisorAutoproxyCreator:
2) Autoproxy creation driven by source-level metadata attributes
(This is a special case of autoproxy creation that deserves to be considered separately)
Types
Around advice: MethodInterceptor
Before advice: MethodBeforeAdvice
After advice: AfterReturningAdvice
Pointcut
Pointcut will select some method to apply advice
JdkregexpmethodPointcut
TransactionAtributeSroucePointcut
PointCut and Advice: P57
General: DefaultPointcutAdvisor has properties: pointcut & advice
NameMatchMethodPointcutAdvisor has properties: mappedNames(do not need to configure pointcut separately) & advice
Dynamic pointcuts incures significant performance penalty
Others:
Monosodium glutamate
c# c sha