if ( Collection.class.isAssignableFrom( type ) && type.isInterface() ) {
AnnotatedElement annotatedElement =
descriptor.getField() != null ? descriptor.getField() : descriptor.getMethodParameter().getMethod();
RefreshableCollection annotation = AnnotationUtils.getAnnotation( annotatedElement,
RefreshableCollection.class );
if ( annotation != null ) {
ResolvableType resolvableType = descriptor.getResolvableType();
if ( resolvableType.hasGenerics() ) {
resolvableType = resolvableType.getNested( 2 );
}
else {
resolvableType = ResolvableType.forClass( Object.class );
}
RefreshableRegistry<?> registry;
if ( annotation.incremental() ) {
registry = new IncrementalRefreshableRegistry<>( resolvableType,
annotation.includeModuleInternals() );
}
else {
registry = new RefreshableRegistry<>( resolvableType, annotation.includeModuleInternals() );
}
autowireBean( registry );
registerSingleton( RefreshableRegistry.class.getName() + "~" + UUID.randomUUID().toString(), registry );