Examples of addAdvice()


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

    }

    private void createTarget(boolean useMock) {
        realTarget = useMock ? mock(ITargetObject.class) : new TargetObject();
        ProxyFactory pf = new ProxyFactory(realTarget);
        pf.addAdvice(interceptor);
        advisedTarget = (ITargetObject) pf.getProxy();
    }

    @Test
    public void gettersReturnExpectedData() {
View Full Code Here

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

  }

  private Object createDirtyCheckingProxy(final String name, final Object scopedObject) throws Throwable {
    ProxyFactory proxyFactoryBean = new ProxyFactory(scopedObject);
    proxyFactoryBean.setProxyTargetClass(this.proxyTargetClass);
    proxyFactoryBean.addAdvice(new MethodInterceptor() {
      public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        Object result = methodInvocation.proceed();
        persistVariable(name, scopedObject);
        return result;
      }
View Full Code Here

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

    public Object getObject() throws Exception {
        if (this.embeddedServlet == null) {
            throw new FactoryBeanNotInitializedException("There might be a circular dependency inside the servlet connections.");
        }
        ProxyFactory proxyFactory = new ProxyFactory(this.embeddedServlet);
        proxyFactory.addAdvice(new ServiceInterceptor());
        if (this.mountPath != null) {
            proxyFactory.addAdvisor(new MountableMixinAdvisor());
        }
        return proxyFactory.getProxy();
    }
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        ErrorBean errorBean = new ErrorBean();

        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(errorBean);
        pf.addAdvice(new SimpleThrowsAdvice());

        ErrorBean proxy = (ErrorBean) pf.getProxy();

        try {
            proxy.errorProneMethod();
View Full Code Here

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

        MessageWriter target = new MessageWriter();

        // create the proxy
        ProxyFactory pf = new ProxyFactory();

        pf.addAdvice(new SimpleAfterReturningAdvice());
        pf.setTarget(target);

        MessageWriter proxy = (MessageWriter) pf.getProxy();

        // write the messages
View Full Code Here

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

        MessageWriter target = new MessageWriter();
       
        // create the proxy
        ProxyFactory pf = new ProxyFactory();

        pf.addAdvice(new MessageDecorator());
        pf.setTarget(target);


        MessageWriter proxy = (MessageWriter) pf.getProxy();
       
View Full Code Here

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

        MessageWriter target = new MessageWriter();

        // create the proxy
        ProxyFactory pf = new ProxyFactory();

        pf.addAdvice(new SimpleBeforeAdvice());
        pf.setTarget(target);

        MessageWriter proxy = (MessageWriter) pf.getProxy();

        // write the messages
View Full Code Here

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

    private static WorkerBean getWorkerBean() {
        WorkerBean target = new WorkerBean();
       
        ProxyFactory factory = new ProxyFactory();
        factory.setTarget(target);
        factory.addAdvice(new ProfilingInterceptor());
       
        return (WorkerBean)factory.getProxy();
    }
}
View Full Code Here

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

        SecurityAdvice advice = new SecurityAdvice();
       
        // get the proxy
        ProxyFactory factory = new ProxyFactory();
        factory.setTarget(target);
        factory.addAdvice(advice);
        SecureBean proxy = (SecureBean)factory.getProxy();
       
        return proxy;
       
    }
View Full Code Here

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

       
        KeyGenerator target = new KeyGenerator();
       
        ProxyFactory factory = new ProxyFactory();
        factory.setTarget(target);
        factory.addAdvice(new WeakKeyCheckAdvice());
       
        return (KeyGenerator)factory.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.