this.scopes = scopes;
}
@Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
if (definition instanceof AnnotatedBeanDefinition) {
AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition)definition;
Set<String> annotationTypes = annDef.getMetadata().getAnnotationTypes();
//
String scopeName;
if (annotationTypes.contains(Singleton.class.getName())) {
scopeName = "singleton";
}
else {
scopeName = "prototype";
for (Scope scope : scopes) {
if (annotationTypes.contains(scope.getAnnotationType().getName())) {
scopeName = scope.name().toLowerCase();
break;
}
}
}
metadata.setScopeName(scopeName);
return metadata;
}
else {
return super.resolveScopeMetadata(definition);
}