Package org.springframework.aop.framework

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


    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


    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 (Class<?> targetInterface : targetInterfaces) {
        proxyFactory.addInterface(targetInterface);
      }
    }

    Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
    for (Advisor advisor : advisors) {
View Full Code Here

    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass);
      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

    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass);
      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

   */
  protected Object getProxyForService() {
    checkService();
    checkServiceInterface();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addInterface(getServiceInterface());
    if (isRegisterTraceInterceptor()) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    proxyFactory.setTarget(getService());
    return proxyFactory.getProxy(this.beanClassLoader);
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

  public void testAopJdkProxy() throws Exception {
    ModelMap map = new ModelMap();
    ProxyFactory factory = new ProxyFactory();
    Map target = new HashMap();
    factory.setTarget(target);
    factory.addInterface(Map.class);
    Object proxy = factory.getProxy();
    map.addAttribute(proxy);
    assertSame(proxy, map.get("map"));
  }
View Full Code Here

  public void testAopJdkProxyWithMultipleInterfaces() throws Exception {
    ModelMap map = new ModelMap();
    Map target = new HashMap();
    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(target);
    factory.addInterface(Serializable.class);
    factory.addInterface(Cloneable.class);
    factory.addInterface(Comparable.class);
    factory.addInterface(Map.class);
    Object proxy = factory.getProxy();
    map.addAttribute(proxy);
View Full Code Here

    ModelMap map = new ModelMap();
    Map target = new HashMap();
    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(target);
    factory.addInterface(Serializable.class);
    factory.addInterface(Cloneable.class);
    factory.addInterface(Comparable.class);
    factory.addInterface(Map.class);
    Object proxy = factory.getProxy();
    map.addAttribute(proxy);
    assertSame(proxy, map.get("map"));
View Full Code Here

    Map target = new HashMap();
    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(target);
    factory.addInterface(Serializable.class);
    factory.addInterface(Cloneable.class);
    factory.addInterface(Comparable.class);
    factory.addInterface(Map.class);
    Object proxy = factory.getProxy();
    map.addAttribute(proxy);
    assertSame(proxy, map.get("map"));
  }
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.