Package org.springframework.aop.target

Examples of org.springframework.aop.target.SingletonTargetSource


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

    this.nonAdvisedBeans.add(cacheKey);
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

    this.servletRequest.setContent(content.getBytes("UTF-8"));
    this.servletRequest.setContentType(MediaType.APPLICATION_JSON_VALUE);

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    HttpMessageConverter target = new MappingJackson2HttpMessageConverter();
    HttpMessageConverter proxy = ProxyFactory.getProxy(HttpMessageConverter.class, new SingletonTargetSource(target));
    converters.add(proxy);
    RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters);

    SimpleBean result = (SimpleBean) processor.resolveArgument(methodParam, mavContainer, webRequest, binderFactory);
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

   * 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

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

    this.advisedBeans.put(cacheKey, Boolean.FALSE);
View Full Code Here

  public Object wrapEndpoint(final Class iface, Object endpointImpl) throws Exception {
    Object endpoint = endpointImpl;

    if (interceptors.size() > 0) {
      ProxyFactory proxyFactory = new ProxyFactory();
      proxyFactory.setTargetSource(new SingletonTargetSource(endpointImpl) {
        @Override
        public Class getTargetClass() {
          return iface;
        }
      });
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);
      Object proxy = createProxy(bean.getClass(), beanName, specificInterceptors, new SingletonTargetSource(bean));
      this.proxyTypes.put(cacheKey, proxy.getClass());
      return proxy;
    }

    this.nonAdvisedBeans.add(cacheKey);
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.