Java Code Examples for org.springframework.aop.aspectj.SingletonAspectInstanceFactory

Following code examples demonstrate how to use org.springframework.aop.aspectj.SingletonAspectInstanceFactoryfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.aop.aspectj.SingletonAspectInstanceFactoryand various code implementation of this class.

	public PointcutAdvisor additionnalPointCut() {
		DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor() ;
		AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() ;
		Method m;
		try {
			m = EhcacheMethodCacheInterceptor.class.getMethod("cache", ProceedingJoinPoint.class);
			advisor.setAdvice(new AspectJAroundAdvice(m, pointcut, new SingletonAspectInstanceFactory(interceptor)));
		} catch (NoSuchMethodException | SecurityException e) {
		return advisor ;

    protected AspectJAroundAdvice createInstance() throws Exception {
        final Class<? extends Object> aspectType = this.aspect.getClass();
        final Method method = ReflectionUtils.findMethod(aspectType, this.method, this.args);
        final SingletonAspectInstanceFactory aif = new SingletonAspectInstanceFactory(this.aspect);
        return new AspectJAroundAdvice(method, pointcut, aif);

Implementation of AspectInstanceFactory that is backed by a specified singleton object, returning th

e same instance for every #getAspectInstance() call. @author Rod Johnson @author Juergen Hoeller @since 2.0 @see SimpleAspectInstanceFactory

Read More