Polishing

This commit is contained in:
Juergen Hoeller
2018-08-08 23:56:17 +02:00
parent 247ec572b2
commit 7cf98261ce
7 changed files with 77 additions and 54 deletions

View File

@@ -131,9 +131,14 @@ public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperati
Collection<CacheOperation> annOps = provider.getCacheOperations(annotationParser);
if (annOps != null) {
if (ops == null) {
ops = new ArrayList<>();
ops = annOps;
}
else {
Collection<CacheOperation> combined = new ArrayList<>(ops.size() + annOps.size());
combined.addAll(ops);
combined.addAll(annOps);
ops = combined;
}
ops.addAll(annOps);
}
}
return ops;

View File

@@ -159,7 +159,7 @@ public abstract class AnnotationConfigUtils {
}
}
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<>(4);
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<>(8);
if (!registry.containsBeanDefinition(CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME)) {
RootBeanDefinition def = new RootBeanDefinition(ConfigurationClassPostProcessor.class);
@@ -200,6 +200,7 @@ public abstract class AnnotationConfigUtils {
def.setSource(source);
beanDefs.add(registerPostProcessor(registry, def, EVENT_LISTENER_PROCESSOR_BEAN_NAME));
}
if (!registry.containsBeanDefinition(EVENT_LISTENER_FACTORY_BEAN_NAME)) {
RootBeanDefinition def = new RootBeanDefinition(DefaultEventListenerFactory.class);
def.setSource(source);

View File

@@ -24,6 +24,7 @@ import org.springframework.core.Ordered;
/**
* Default {@link EventListenerFactory} implementation that supports the
* regular {@link EventListener} annotation.
*
* <p>Used as "catch-all" implementation by default.
*
* @author Stephane Nicoll
@@ -33,14 +34,16 @@ public class DefaultEventListenerFactory implements EventListenerFactory, Ordere
private int order = LOWEST_PRECEDENCE;
public void setOrder(int order) {
this.order = order;
}
@Override
public int getOrder() {
return this.order;
}
public void setOrder(int order) {
this.order = order;
}
public boolean supportsMethod(Method method) {
return true;