Package org.springframework.beans.factory.wiring

Examples of org.springframework.beans.factory.wiring.BeanConfigurerSupport


  }


  public void afterPropertiesSet() {
    if (configurer == null) {
      configurer = new BeanConfigurerSupport();
      configurer.setBeanFactory(beanFactory);
      configurer.afterPropertiesSet();
    }

    if (autoRegister) {
View Full Code Here


  private static final String BEAN_NAME_PROP = "bean-name";

  @Override
  protected void initInstance(Properties props) {
    BeanFactory bf = getBeanFactory();
    BeanConfigurerSupport configurer = new BeanConfigurerSupport();
    configurer.setBeanFactory(bf);

    final String beanName = props.getProperty(BEAN_NAME_PROP);
    // key specified, search for a bean
    if (beanName != null) {
      if (!bf.containsBean(beanName)) {
        throw new IllegalArgumentException("Cannot find bean named '" + beanName + "'");
      }
      configurer.setBeanWiringInfoResolver(new BeanWiringInfoResolver() {

        public BeanWiringInfo resolveWiringInfo(Object beanInstance) {
          return new BeanWiringInfo(beanName);
        }
      });
    }

    configurer.afterPropertiesSet();
    configurer.configureBean(this);
    configurer.destroy();
  }
View Full Code Here

   * @see org.springframework.beans.factory.wiring.BeanConfigurerSupport
   * @see org.springframework.beans.factory.wiring.BeanWiringInfo
   * @see org.springframework.beans.factory.wiring.BeanWiringInfoResolver
   */
  /* package-private */ void doInit(final ConfigurableListableBeanFactory beanFactory, final Properties parameters) {
    BeanConfigurerSupport beanConfigurer = new BeanConfigurerSupport();

    beanConfigurer.setBeanFactory(beanFactory);

    final String templateBeanName = parameters.getProperty(BEAN_NAME_PARAMETER);

    if (StringUtils.hasText(templateBeanName)) {
      if (beanFactory.containsBean(templateBeanName)) {
        beanConfigurer.setBeanWiringInfoResolver(new BeanWiringInfoResolver() {
          @Override public BeanWiringInfo resolveWiringInfo(final Object beanInstance) {
            return new BeanWiringInfo(templateBeanName);
          }
        });
      }
      else {
        throw new IllegalArgumentException(String.format(
          "No bean with name '%1$s' was found in the Spring context '%2$s'.", templateBeanName, beanFactory));
      }
    }

    beanConfigurer.afterPropertiesSet();
    beanConfigurer.configureBean(this);
    beanConfigurer.destroy();

    initialized = true;

    doPostInit(parameters);
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.wiring.BeanConfigurerSupport

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.