41
41
import org .springframework .aop .scope .ScopedProxyUtils ;
42
42
import org .springframework .beans .factory .ListableBeanFactory ;
43
43
import org .springframework .beans .factory .support .BeanDefinitionRegistry ;
44
+ import org .springframework .core .Ordered ;
44
45
import org .springframework .core .annotation .AnnotationAwareOrderComparator ;
45
46
import org .springframework .core .annotation .Order ;
46
47
import org .springframework .util .Assert ;
@@ -198,20 +199,18 @@ private <T, B extends T> void addAsRegistrationBean(ListableBeanFactory beanFact
198
199
}
199
200
200
201
private int getOrder (Object value ) {
201
- return new AnnotationAwareOrderComparator () {
202
- @ Override
203
- public int getOrder (Object obj ) {
204
- return super .getOrder (obj );
205
- }
206
- }.getOrder (value );
202
+ Integer order = findOrder (value );
203
+ return (order != null ) ? order : Ordered .LOWEST_PRECEDENCE ;
207
204
}
208
205
209
206
private Integer findOrder (Object value ) {
210
207
return new AnnotationAwareOrderComparator () {
208
+
211
209
@ Override
212
210
public Integer findOrder (Object obj ) {
213
211
return super .findOrder (obj );
214
212
}
213
+
215
214
}.findOrder (value );
216
215
}
217
216
@@ -318,9 +317,7 @@ private void configureFromAnnotation(ServletRegistrationBean<Servlet> bean, Serv
318
317
bean .setAsyncSupported (registration .asyncSupported ());
319
318
bean .setIgnoreRegistrationFailure (registration .ignoreRegistrationFailure ());
320
319
bean .setLoadOnStartup (registration .loadOnStartup ());
321
- if (registration .urlMappings ().length > 0 ) {
322
- bean .setUrlMappings (Arrays .asList (registration .urlMappings ()));
323
- }
320
+ bean .setUrlMappings (Arrays .asList (registration .urlMappings ()));
324
321
}
325
322
326
323
}
@@ -363,12 +360,8 @@ private void configureFromAnnotation(FilterRegistrationBean<Filter> bean, Filter
363
360
}
364
361
bean .setIgnoreRegistrationFailure (registration .ignoreRegistrationFailure ());
365
362
bean .setMatchAfter (registration .matchAfter ());
366
- if (registration .servletNames ().length > 0 ) {
367
- bean .setServletNames (Arrays .asList (registration .servletNames ()));
368
- }
369
- if (registration .urlPatterns ().length > 0 ) {
370
- bean .setUrlPatterns (Arrays .asList (registration .urlPatterns ()));
371
- }
363
+ bean .setServletNames (Arrays .asList (registration .servletNames ()));
364
+ bean .setUrlPatterns (Arrays .asList (registration .urlPatterns ()));
372
365
}
373
366
374
367
}
@@ -387,6 +380,9 @@ public RegistrationBean createRegistrationBean(String beanName, EventListener so
387
380
388
381
}
389
382
383
+ /**
384
+ * Tracks seen initializers.
385
+ */
390
386
private static final class Seen {
391
387
392
388
private final Map <Class <?>, Set <Object >> seen = new HashMap <>();
0 commit comments