Package org.springframework.aop.framework

Examples of org.springframework.aop.framework.ProxyFactoryBean.addAdvice()


    // Proxy worker so that Jpa EntityManager will be properly handled
    final ProxyFactoryBean pfb = new ProxyFactoryBean();
    pfb.setTarget(targetWorker);
    pfb.setInterfaces(targetWorker.getClass().getInterfaces());
    pfb.addAdvice(jpaInterceptor);
  
    this.worker = (IWorker)pfb.getObject();

    this.workTracker = tp.submit(this.worker); // XXX is execute okay?
    this.rendering = true;
View Full Code Here


        // Proxy IChannelPublisher so that Jpa EntityManager will be properly handled
        final ProxyFactoryBean pfb = new ProxyFactoryBean();
        pfb.setTarget(channelPublisher);
        pfb.setInterfaces(channelPublisher.getClass().getInterfaces());
        pfb.addAdvice(jpaInterceptor);
       
        return (IChannelPublisher)pfb.getObject();
    }

    /*
 
View Full Code Here

  public Object addJSFMessageHandling(
      Object target) {
    ProxyFactoryBean proxyCreatorSupport = new ProxyFactoryBean();
    proxyCreatorSupport.setTarget(target);
    proxyCreatorSupport.addAdvice(new JsfMessageInterceptor());
    proxyCreatorSupport.setOptimize(true);
    proxyCreatorSupport.setOpaque(false);
    return proxyCreatorSupport.getObject();
  }
 
View Full Code Here

 
  @SuppressWarnings("unchecked")
  public <T> T addTransactionSupport(T target) {
    ProxyFactoryBean proxyCreatorSupport = new ProxyFactoryBean();
    proxyCreatorSupport.setTarget(target);
    proxyCreatorSupport.addAdvice(transactionInterceptor());
    proxyCreatorSupport.setOptimize(true);
    proxyCreatorSupport.setOpaque(false);
    return (T)proxyCreatorSupport.getObject();
  }
 
View Full Code Here

  @Test
  public void testLoggingTheCurrentlyExecutingMethodName() throws Throwable {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setProxyTargetClass(true);
    proxyFactoryBean.addAdvice(new CurrentMethodExposingMethodInterceptor());
    proxyFactoryBean.setTarget(new TestClassWithAMethod());

    TestClassWithAMethod testClassWithAMethod = (TestClassWithAMethod) proxyFactoryBean.getObject();
    testClassWithAMethod.testMe();
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.