* @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);
}