}
@Override
void configure(String name, SpringInjector builder, DefaultListableBeanFactory factory) {
String id = Tools.nextUUID();
AnnotatedGenericBeanDefinition def = new AnnotatedGenericBeanDefinition(provider.getClass());
def.setScope("singleton");
factory.registerBeanDefinition(id, def);
builder.instances.put(id, provider);
//
AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(type);
//
if (scope != null) {
definition.setScope(scope.name().toLowerCase());
}
else {
ScopeMetadata scopeMD = builder.scopeResolver.resolveScopeMetadata(definition);
if (scopeMD != null) {
definition.setScope(scopeMD.getScopeName());
}
}
//
if (qualifiers != null) {
for (AutowireCandidateQualifier qualifier : qualifiers) {
definition.addQualifier(qualifier);
}
}
//
if (qualifiers != null) {
for (AutowireCandidateQualifier qualifier : qualifiers) {
definition.addQualifier(qualifier);
}
}
//
definition.setFactoryBeanName(id);
definition.setFactoryMethodName("get");
//
factory.registerBeanDefinition(name, definition);
}