@Override public void afterPropertiesSet() throws Exception { Assert.hasText(this.targetBeanName, "Property 'targetBeanName' is required"); super.afterPropertiesSet(); }
/** * Destroy the singleton instance, if any. * @see #destroyInstance(Object) */ @Override public void destroy() throws Exception { if (isSingleton()) { destroyInstance(this.singletonInstance); } }
/** * Expose the singleton instance or create a new prototype instance. * @see #createInstance() * @see #getEarlySingletonInterfaces() */ @Override public final T getObject() throws Exception { if (isSingleton()) { return (this.initialized ? this.singletonInstance : getEarlySingletonInstance()); } else { return createInstance(); } }
/** * Eagerly create the singleton instance, if necessary. */ @Override public void afterPropertiesSet() throws Exception { if (isSingleton()) { this.initialized = true; this.singletonInstance = createInstance(); this.earlySingletonInstance = null; } }
public void destroy() throws Exception { if (this.singleton) { destroyInstance(this.singletonInstance); } }
@Bean public Bar bar() throws Exception { assertTrue(foo().isSingleton()); return new Bar(foo().getObject()); } }
/** * Obtain a bean type converter from the BeanFactory that this bean * runs in. This is typically a fresh instance for each call, * since TypeConverters are usually <i>not</i> thread-safe. * <p>Falls back to a SimpleTypeConverter when not running in a BeanFactory. * @see ConfigurableBeanFactory#getTypeConverter() * @see org.springframework.beans.SimpleTypeConverter */ protected TypeConverter getBeanTypeConverter() { BeanFactory beanFactory = getBeanFactory(); if (beanFactory instanceof ConfigurableBeanFactory) { return ((ConfigurableBeanFactory) beanFactory).getTypeConverter(); } else { return new SimpleTypeConverter(); } }
public void afterPropertiesSet() throws Exception { if (this.singleton) { this.singletonInstance = createInstance(); } }
/** * Eagerly create the singleton instance, if necessary. */ @Override public void afterPropertiesSet() throws Exception { if (isSingleton()) { this.initialized = true; this.singletonInstance = createInstance(); this.earlySingletonInstance = null; } }
protected void destroyInstance(Object instance) throws Exception { super.destroyInstance(instance); LdapTestUtils.shutdownEmbeddedServer(); } }
/** * Obtain a bean type converter from the BeanFactory that this bean * runs in. This is typically a fresh instance for each call, * since TypeConverters are usually <i>not</i> thread-safe. * <p>Falls back to a SimpleTypeConverter when not running in a BeanFactory. * @see ConfigurableBeanFactory#getTypeConverter() * @see org.springframework.beans.SimpleTypeConverter */ protected TypeConverter getBeanTypeConverter() { BeanFactory beanFactory = getBeanFactory(); if (beanFactory instanceof ConfigurableBeanFactory) { return ((ConfigurableBeanFactory) beanFactory).getTypeConverter(); } else { return new SimpleTypeConverter(); } }
public final Object getObject() throws Exception { if (this.singleton) { return this.singletonInstance; } else { return createInstance(); } }
@Override public void afterPropertiesSet() throws Exception { Assert.hasText(this.targetBeanName, "Property 'targetBeanName' is required"); super.afterPropertiesSet(); }
/** * Expose the singleton instance or create a new prototype instance. * @see #createInstance() * @see #getEarlySingletonInterfaces() */ @Override public final T getObject() throws Exception { if (isSingleton()) { return (this.initialized ? this.singletonInstance : getEarlySingletonInstance()); } else { return createInstance(); } }
/** * Destroy the singleton instance, if any. * @see #destroyInstance(Object) */ @Override public void destroy() throws Exception { if (isSingleton()) { destroyInstance(this.singletonInstance); } }
/** * Eagerly create the singleton instance, if necessary. */ public void afterPropertiesSet() throws Exception { if (isSingleton()) { this.initialized = true; this.singletonInstance = createInstance(); this.earlySingletonInstance = null; } }
/** {@inheritDoc}. Call our destroy method if aposite. */ @Override protected void destroyInstance(final T instance) throws Exception { super.destroyInstance(instance); ComponentSupport.destroy(instance); }
/** * Obtain a bean type converter from the BeanFactory that this bean * runs in. This is typically a fresh instance for each call, * since TypeConverters are usually <i>not</i> thread-safe. * <p>Falls back to a SimpleTypeConverter when not running in a BeanFactory. * @see ConfigurableBeanFactory#getTypeConverter() * @see org.springframework.beans.SimpleTypeConverter */ protected TypeConverter getBeanTypeConverter() { BeanFactory beanFactory = getBeanFactory(); if (beanFactory instanceof ConfigurableBeanFactory) { return ((ConfigurableBeanFactory) beanFactory).getTypeConverter(); } else { return new SimpleTypeConverter(); } }
@Override public void afterPropertiesSet() throws Exception { Assert.hasText(this.targetBeanName, "Property 'targetBeanName' is required"); super.afterPropertiesSet(); }
/** * Expose the singleton instance or create a new prototype instance. * @see #createInstance() * @see #getEarlySingletonInterfaces() */ public final T getObject() throws Exception { if (isSingleton()) { return (this.initialized ? this.singletonInstance : getEarlySingletonInstance()); } else { return createInstance(); } }