Polishing
This commit is contained in:
parent
196bb6fe32
commit
d14140da69
|
@ -76,9 +76,8 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
new InstanceComparator<>(
|
||||
Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class),
|
||||
(Converter<Method, Annotation>) method -> {
|
||||
AspectJAnnotation<?> annotation =
|
||||
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method);
|
||||
return (annotation != null ? annotation.getAnnotation() : null);
|
||||
AspectJAnnotation<?> ann = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method);
|
||||
return (ann != null ? ann.getAnnotation() : null);
|
||||
});
|
||||
Comparator<Method> methodNameComparator = new ConvertingComparator<>(Method::getName);
|
||||
METHOD_COMPARATOR = adviceKindComparator.thenComparing(methodNameComparator);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -138,14 +138,8 @@ class AspectJPrecedenceComparator implements Comparator<Advisor> {
|
|||
}
|
||||
|
||||
private int getAspectDeclarationOrder(Advisor anAdvisor) {
|
||||
AspectJPrecedenceInformation precedenceInfo =
|
||||
AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
|
||||
if (precedenceInfo != null) {
|
||||
return precedenceInfo.getDeclarationOrder();
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
AspectJPrecedenceInformation precedenceInfo = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
|
||||
return (precedenceInfo != null ? precedenceInfo.getDeclarationOrder() : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -42,6 +42,7 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
|
||||
private final WebFluxConfigurerComposite configurers = new WebFluxConfigurerComposite();
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
public void setConfigurers(List<WebFluxConfigurer> configurers) {
|
||||
if (!CollectionUtils.isEmpty(configurers)) {
|
||||
|
@ -49,6 +50,7 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
this.configurers.configureContentTypeResolver(builder);
|
||||
|
@ -100,4 +102,5 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
protected void configureViewResolvers(ViewResolverRegistry registry) {
|
||||
this.configurers.configureViewResolvers(registry);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -93,10 +93,6 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
@Nullable
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Nullable
|
||||
public final ApplicationContext getApplicationContext() {
|
||||
return this.applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(@Nullable ApplicationContext applicationContext) {
|
||||
|
@ -108,6 +104,12 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final ApplicationContext getApplicationContext() {
|
||||
return this.applicationContext;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public DispatcherHandler webHandler() {
|
||||
return new DispatcherHandler();
|
||||
|
@ -122,6 +124,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
@Bean
|
||||
public RequestMappingHandlerMapping requestMappingHandlerMapping(
|
||||
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
|
||||
|
||||
RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
|
||||
mapping.setOrder(0);
|
||||
mapping.setContentTypeResolver(contentTypeResolver);
|
||||
|
@ -205,7 +208,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
@Bean
|
||||
public RouterFunctionMapping routerFunctionMapping(ServerCodecConfigurer serverCodecConfigurer) {
|
||||
RouterFunctionMapping mapping = createRouterFunctionMapping();
|
||||
mapping.setOrder(-1); // go before RequestMappingHandlerMapping
|
||||
mapping.setOrder(-1); // go before RequestMappingHandlerMapping
|
||||
mapping.setMessageReaders(serverCodecConfigurer.getReaders());
|
||||
mapping.setCorsConfigurations(getCorsConfigurations());
|
||||
|
||||
|
@ -330,8 +333,8 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
* initializing all {@link WebDataBinder} instances.
|
||||
*/
|
||||
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(
|
||||
FormattingConversionService webFluxConversionService,
|
||||
Validator webFluxValidator) {
|
||||
FormattingConversionService webFluxConversionService, Validator webFluxValidator) {
|
||||
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(webFluxConversionService);
|
||||
initializer.setValidator(webFluxValidator);
|
||||
|
@ -430,6 +433,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
|
||||
ServerCodecConfigurer serverCodecConfigurer,
|
||||
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
|
||||
|
||||
return new ResponseEntityResultHandler(serverCodecConfigurer.getWriters(),
|
||||
contentTypeResolver, reactiveAdapterRegistry);
|
||||
}
|
||||
|
@ -439,6 +443,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
|
||||
ServerCodecConfigurer serverCodecConfigurer,
|
||||
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
|
||||
|
||||
return new ResponseBodyResultHandler(serverCodecConfigurer.getWriters(),
|
||||
contentTypeResolver, reactiveAdapterRegistry);
|
||||
}
|
||||
|
@ -447,6 +452,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
public ViewResolutionResultHandler viewResolutionResultHandler(
|
||||
@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry,
|
||||
@Qualifier("webFluxContentTypeResolver") RequestedContentTypeResolver contentTypeResolver) {
|
||||
|
||||
ViewResolverRegistry registry = getViewResolverRegistry();
|
||||
List<ViewResolver> resolvers = registry.getViewResolvers();
|
||||
ViewResolutionResultHandler handler = new ViewResolutionResultHandler(
|
||||
|
@ -457,8 +463,7 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public ServerResponseResultHandler serverResponseResultHandler(
|
||||
ServerCodecConfigurer serverCodecConfigurer) {
|
||||
public ServerResponseResultHandler serverResponseResultHandler(ServerCodecConfigurer serverCodecConfigurer) {
|
||||
List<ViewResolver> resolvers = getViewResolverRegistry().getViewResolvers();
|
||||
ServerResponseResultHandler handler = new ServerResponseResultHandler();
|
||||
handler.setMessageWriters(serverCodecConfigurer.getWriters());
|
||||
|
|
Loading…
Reference in New Issue