* @return
*/
private BeanDefinitionHolder applyScopeOn(BeanDefinitionRegistry registry, BeanDefinitionHolder definition,
ScopeMetadata scopeMetadata) {
String scope = scopeMetadata.getScopeName();
ScopedProxyMode proxyMode = scopeMetadata.getScopedProxyMode();
definition.getBeanDefinition().setScope(scope);
if (BeanDefinition.SCOPE_SINGLETON.equals(scope) || BeanDefinition.SCOPE_PROTOTYPE.equals(scope)
|| proxyMode.equals(ScopedProxyMode.NO)) {
return definition;
} else {
boolean proxyTargetClass = proxyMode.equals(ScopedProxyMode.TARGET_CLASS);
return ScopedProxyUtils.createScopedProxy(definition, registry, proxyTargetClass);
}
}