* @return Object
* @throws BlueprintTemplateException
*/
@Override
protected Object createNewInstance(Erector erector) throws BlueprintTemplateException {
SpringBlueprint springBlueprint = erector.getBlueprint().getClass().getAnnotation(SpringBlueprint.class);
if ( springBlueprint != null && springBlueprint.bean() ) {
Class beanClass = springBlueprint.beanClass();
if ( beanClass.equals( NotSet.class) ) {
beanClass = erector.getTarget();
}
try {
if ( StringUtils.isNotBlank( springBlueprint.beanName() ) ) {
logger.debug( "Retrieving model from Spring [{},{}]", springBlueprint.beanName(), beanClass );
return applicationContext.getBean( springBlueprint.beanName(), beanClass );
} else {
logger.debug( "Retrieving model from Spring [{}]", beanClass );
return applicationContext.getBean( beanClass );
}
} catch( NoSuchBeanDefinitionException e ) {