Package org.springframework.aop.framework

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


    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass, this.proxyClassLoader);
      for (int i = 0; i < targetInterfaces.length; i++) {
        proxyFactory.addInterface(targetInterfaces[i]);
      }
    }

    Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
    for (int i = 0; i < advisors.length; i++) {
View Full Code Here


    ScopedObject scopedObject = new DefaultScopedObject(cbf, this.scopedTargetSource.getTargetBeanName());
    pf.addAdvice(new DelegatingIntroductionInterceptor(scopedObject));

    // Add the AopInfrastructureBean marker to indicate that the scoped proxy
    // itself is not subject to auto-proxying! Only its target bean is.
    pf.addInterface(AopInfrastructureBean.class);

    this.proxy = pf.getProxy(cbf.getBeanClassLoader());
  }

View Full Code Here

   */
  protected Object getProxyForService() {
    checkService();
    checkServiceInterface();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addInterface(getServiceInterface());
    if (this.registerTraceInterceptor != null ?
        this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    if (this.interceptors != null) {
View Full Code Here

  }

  public void testWithInterface() {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new TestWithInterfaceImpl());
    proxyFactory.addInterface(TestWithInterface.class);
    proxyFactory.addAdvice(this.ti);

    TestWithInterface proxy = (TestWithInterface) proxyFactory.getProxy();

    proxy.doSomething();
View Full Code Here

  }

  public void testCrossClassInterfaceMethodLevelOnJdkProxy() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new SomeServiceImpl());
    proxyFactory.addInterface(SomeService.class);
    proxyFactory.addAdvice(this.ti);

    SomeService someService = (SomeService) proxyFactory.getProxy();

    someService.bar();
View Full Code Here

  }

  public void testCrossClassInterfaceOnJdkProxy() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new OtherServiceImpl());
    proxyFactory.addInterface(OtherService.class);
    proxyFactory.addAdvice(this.ti);

    OtherService otherService = (OtherService) proxyFactory.getProxy();

    otherService.foo();
View Full Code Here

   public Object locateBean(String beanName, Class targetType)
   {
      TargetSource targetSource = new LocatorTargetSource(beanName, targetType);
      ProxyFactory proxyFactory = new ProxyFactory();
      proxyFactory.addInterface(targetType);
      proxyFactory.setTargetSource(targetSource);
      return proxyFactory.getProxy();
   }

   private class LocatorTargetSource implements TargetSource
View Full Code Here

  public void afterPropertiesSet() {
    super.afterPropertiesSet();

    // Build a proxy that also exposes the JAX-WS BindingProvider interface.
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(getServiceInterface());
    pf.addInterface(BindingProvider.class);
    pf.addAdvice(this);
    this.serviceProxy = pf.getProxy(getBeanClassLoader());
  }
View Full Code Here

    super.afterPropertiesSet();

    // Build a proxy that also exposes the JAX-WS BindingProvider interface.
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(getServiceInterface());
    pf.addInterface(BindingProvider.class);
    pf.addAdvice(this);
    this.serviceProxy = pf.getProxy(getBeanClassLoader());
  }

View Full Code Here

   */
  protected Object getProxyForService() {
    checkService();
    checkServiceInterface();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addInterface(getServiceInterface());
    if (this.registerTraceInterceptor != null ?
        this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    if (this.interceptors != null) {
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.