Package org.springframework.aop.aspectj.annotation

Examples of org.springframework.aop.aspectj.annotation.AspectJProxyFactory.addAspect()


    AspectJProxyFactory factory = new AspectJProxyFactory();
    factory.setTarget(testBean);

    CounterAspect myCounterAspect = new CounterAspect();
    factory.addAspect(myCounterAspect);

    ITestBean proxyTestBean = factory.getProxy();

    assertTrue("Expected a proxy", proxyTestBean instanceof Advised);
    proxyTestBean.setAge(20);
View Full Code Here


    AspectJProxyFactory factory = new AspectJProxyFactory();
    factory.setTarget(testBean);

    CounterAspect myCounterAspect = new CounterAspect();
    factory.addAspect(myCounterAspect);

    ITestBean proxyTestBean = factory.getProxy();

    assertTrue("Expected a proxy", proxyTestBean instanceof Advised);
    proxyTestBean.setAge(20);
View Full Code Here

  @SuppressWarnings("unchecked")
  public <T> T criarProxy(T target, Class<?>... aspects) {
    AspectJProxyFactory proxy = new AspectJProxyFactory(target);
    proxy.setProxyTargetClass(true);
    for (Class<?> aspectClass : aspects) {
      proxy.addAspect(aspectClass);
    }
    return (T) proxy.getProxy();
  }
}
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.