Package org.springframework.aop.target

Examples of org.springframework.aop.target.SingletonTargetSource


   * Will create a SingletonTargetSource for the object.
   * @see #setTargetSource
   * @see org.springframework.aop.target.SingletonTargetSource
   */
  public void setTarget(Object target) {
    setTargetSource(new SingletonTargetSource(target));
  }
View Full Code Here


      }
      if (logger.isDebugEnabled()) {
        logger.debug("Refreshing target with name '" + this.targetName + "'");
      }
      Object target = this.beanFactory.getBean(this.targetName);
      return (target instanceof TargetSource ? (TargetSource) target : new SingletonTargetSource(target));
    }
  }
View Full Code Here

  protected TargetSource createTargetSource(Object target) {
    if (target instanceof TargetSource) {
      return (TargetSource) target;
    }
    else {
      return new SingletonTargetSource(target);
    }
  }
View Full Code Here

    // Create proxy if we have advice.
    Object[] specificInterceptors = getAdvicesAndAdvisorsForBean(bean.getClass(), beanName, null);
    if (specificInterceptors != DO_NOT_PROXY) {
      this.advisedBeans.add(cacheKey);
      return createProxy(bean.getClass(), beanName, specificInterceptors, new SingletonTargetSource(bean));
    }

    this.nonAdvisedBeans.add(cacheKey);
    return bean;
  }
View Full Code Here

    else {
      if (logger.isDebugEnabled()) {
        logger.debug("Refreshing target with name '" + this.targetName + "'");
      }
      Object target = this.beanFactory.getBean(this.targetName);
      return (target instanceof TargetSource ? (TargetSource) target : new SingletonTargetSource(target));
    }
  }
View Full Code Here

    // Create proxy if we have advice.
    Object[] specificInterceptors = getAdvicesAndAdvisorsForBean(bean.getClass(), beanName, null);
    if (specificInterceptors != DO_NOT_PROXY) {
      this.advisedBeans.add(cacheKey);
      return createProxy(bean.getClass(), beanName, specificInterceptors, new SingletonTargetSource(bean));
    }

    this.nonAdvisedBeans.add(cacheKey);
    return bean;
  }
View Full Code Here

   * Will create a SingletonTargetSource for the object.
   * @see #setTargetSource
   * @see org.springframework.aop.target.SingletonTargetSource
   */
  public void setTarget(Object target) {
    setTargetSource(new SingletonTargetSource(target));
  }
View Full Code Here

  protected TargetSource createTargetSource(Object target) {
    if (target instanceof TargetSource) {
      return (TargetSource) target;
    }
    else {
      return new SingletonTargetSource(target);
    }
  }
View Full Code Here

    return mns;
  }

  public void testWithJdkProxy() throws Exception {
    IJmxTestBean proxy =
        (IJmxTestBean) ProxyFactory.getProxy(IJmxTestBean.class, new SingletonTargetSource(new JmxTestBean()));
    assertEquals(ObjectNameManager.getInstance("spring:bean=test"), getStrategy().getObjectName(proxy, "foo"));
  }
View Full Code Here

    assertEquals(nop.getCount(), 5);

    // Change back, relying on casting to Advised
    Advised advised = (Advised) proxy;
    assertSame(hts, advised.getTargetSource());
    SingletonTargetSource sts = new SingletonTargetSource(tb2);
    advised.setTargetSource(sts);
    assertEquals(tb2.getName(), proxy.getName());
    assertSame(sts, advised.getTargetSource());
    assertEquals(tb2.getAge(), proxy.getAge());
  }
View Full Code Here

TOP

Related Classes of org.springframework.aop.target.SingletonTargetSource

Copyright © 2018 www.massapicom. 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.