Skip to content

Commit d14140d

Browse files
committed
Polishing
1 parent 196bb6f commit d14140d

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
7676
new InstanceComparator<>(
7777
Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class),
7878
(Converter<Method, Annotation>) method -> {
79-
AspectJAnnotation<?> annotation =
80-
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method);
81-
return (annotation != null ? annotation.getAnnotation() : null);
79+
AspectJAnnotation<?> ann = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method);
80+
return (ann != null ? ann.getAnnotation() : null);
8281
});
8382
Comparator<Method> methodNameComparator = new ConvertingComparator<>(Method::getName);
8483
METHOD_COMPARATOR = adviceKindComparator.thenComparing(methodNameComparator);

spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -138,14 +138,8 @@ private String getAspectName(Advisor anAdvisor) {
138138
}
139139

140140
private int getAspectDeclarationOrder(Advisor anAdvisor) {
141-
AspectJPrecedenceInformation precedenceInfo =
142-
AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
143-
if (precedenceInfo != null) {
144-
return precedenceInfo.getDeclarationOrder();
145-
}
146-
else {
147-
return 0;
148-
}
141+
AspectJPrecedenceInformation precedenceInfo = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
142+
return (precedenceInfo != null ? precedenceInfo.getDeclarationOrder() : 0);
149143
}
150144

151145
}

spring-webflux/src/main/java/org/springframework/web/reactive/config/DelegatingWebFluxConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,13 +42,15 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
4242

4343
private final WebFluxConfigurerComposite configurers = new WebFluxConfigurerComposite();
4444

45+
4546
@Autowired(required = false)
4647
public void setConfigurers(List<WebFluxConfigurer> configurers) {
4748
if (!CollectionUtils.isEmpty(configurers)) {
4849
this.configurers.addWebFluxConfigurers(configurers);
4950
}
5051
}
5152

53+
5254
@Override
5355
protected void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
5456
this.configurers.configureContentTypeResolver(builder);
@@ -100,4 +102,5 @@ protected MessageCodesResolver getMessageCodesResolver() {
100102
protected void configureViewResolvers(ViewResolverRegistry registry) {
101103
this.configurers.configureViewResolvers(registry);
102104
}
105+
103106
}

spring-webflux/src/main/java/org/springframework/web/reactive/config/WebFluxConfigurationSupport.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,10 +93,6 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
9393
@Nullable
9494
private ApplicationContext applicationContext;
9595

96-
@Nullable
97-
public final ApplicationContext getApplicationContext() {
98-
return this.applicationContext;
99-
}
10096

10197
@Override
10298
public void setApplicationContext(@Nullable ApplicationContext applicationContext) {
@@ -108,6 +104,12 @@ public void setApplicationContext(@Nullable ApplicationContext applicationContex
108104
}
109105
}
110106

107+
@Nullable
108+
public final ApplicationContext getApplicationContext() {
109+
return this.applicationContext;
110+
}
111+
112+
111113
@Bean
112114
public DispatcherHandler webHandler() {
113115
return new DispatcherHandler();
@@ -122,6 +124,7 @@ public WebExceptionHandler responseStatusExceptionHandler() {
122124
@Bean
123125
public RequestMappingHandlerMapping requestMappingHandlerMapping(
124126
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
127+
125128
RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
126129
mapping.setOrder(0);
127130
mapping.setContentTypeResolver(contentTypeResolver);
@@ -205,7 +208,7 @@ public void configurePathMatching(PathMatchConfigurer configurer) {
205208
@Bean
206209
public RouterFunctionMapping routerFunctionMapping(ServerCodecConfigurer serverCodecConfigurer) {
207210
RouterFunctionMapping mapping = createRouterFunctionMapping();
208-
mapping.setOrder(-1); // go before RequestMappingHandlerMapping
211+
mapping.setOrder(-1); // go before RequestMappingHandlerMapping
209212
mapping.setMessageReaders(serverCodecConfigurer.getReaders());
210213
mapping.setCorsConfigurations(getCorsConfigurations());
211214

@@ -330,8 +333,8 @@ protected void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
330333
* initializing all {@link WebDataBinder} instances.
331334
*/
332335
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(
333-
FormattingConversionService webFluxConversionService,
334-
Validator webFluxValidator) {
336+
FormattingConversionService webFluxConversionService, Validator webFluxValidator) {
337+
335338
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
336339
initializer.setConversionService(webFluxConversionService);
337340
initializer.setValidator(webFluxValidator);
@@ -430,6 +433,7 @@ public ResponseEntityResultHandler responseEntityResultHandler(
430433
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
431434
ServerCodecConfigurer serverCodecConfigurer,
432435
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
436+
433437
return new ResponseEntityResultHandler(serverCodecConfigurer.getWriters(),
434438
contentTypeResolver, reactiveAdapterRegistry);
435439
}
@@ -439,6 +443,7 @@ public ResponseBodyResultHandler responseBodyResultHandler(
439443
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
440444
ServerCodecConfigurer serverCodecConfigurer,
441445
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
446+
442447
return new ResponseBodyResultHandler(serverCodecConfigurer.getWriters(),
443448
contentTypeResolver, reactiveAdapterRegistry);
444449
}
@@ -447,6 +452,7 @@ public ResponseBodyResultHandler responseBodyResultHandler(
447452
public ViewResolutionResultHandler viewResolutionResultHandler(
448453
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
449454
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
455+
450456
ViewResolverRegistry registry = getViewResolverRegistry();
451457
List<ViewResolver> resolvers = registry.getViewResolvers();
452458
ViewResolutionResultHandler handler = new ViewResolutionResultHandler(
@@ -457,8 +463,7 @@ public ViewResolutionResultHandler viewResolutionResultHandler(
457463
}
458464

459465
@Bean
460-
public ServerResponseResultHandler serverResponseResultHandler(
461-
ServerCodecConfigurer serverCodecConfigurer) {
466+
public ServerResponseResultHandler serverResponseResultHandler(ServerCodecConfigurer serverCodecConfigurer) {
462467
List<ViewResolver> resolvers = getViewResolverRegistry().getViewResolvers();
463468
ServerResponseResultHandler handler = new ServerResponseResultHandler();
464469
handler.setMessageWriters(serverCodecConfigurer.getWriters());

0 commit comments

Comments
 (0)