Merge branch '5.1.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -94,11 +94,10 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
EventListener ann = AnnotatedElementUtils.findMergedAnnotation(this.targetMethod, EventListener.class);
|
||||
this.declaredEventTypes = resolveDeclaredEventTypes(method, ann);
|
||||
this.condition = (ann != null ? ann.condition() : null);
|
||||
this.order = resolveOrder(method);
|
||||
this.order = resolveOrder(this.targetMethod);
|
||||
}
|
||||
|
||||
|
||||
private List<ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable EventListener ann) {
|
||||
private static List<ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable EventListener ann) {
|
||||
int count = method.getParameterCount();
|
||||
if (count > 1) {
|
||||
throw new IllegalStateException(
|
||||
@@ -123,11 +122,12 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
return Collections.singletonList(ResolvableType.forMethodParameter(method, 0));
|
||||
}
|
||||
|
||||
private int resolveOrder(Method method) {
|
||||
private static int resolveOrder(Method method) {
|
||||
Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
|
||||
return (ann != null ? ann.value() : 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize this instance.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -61,15 +61,14 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
|
||||
*/
|
||||
public DecoderHttpMessageReader(Decoder<T> decoder) {
|
||||
Assert.notNull(decoder, "Decoder is required");
|
||||
initLogger(decoder);
|
||||
this.decoder = decoder;
|
||||
this.mediaTypes = MediaType.asMediaTypes(decoder.getDecodableMimeTypes());
|
||||
initLogger(decoder);
|
||||
}
|
||||
|
||||
private void initLogger(Decoder<T> decoder) {
|
||||
private static void initLogger(Decoder<?> decoder) {
|
||||
if (decoder instanceof AbstractDecoder &&
|
||||
decoder.getClass().getPackage().getName().startsWith("org.springframework.core.codec")) {
|
||||
|
||||
decoder.getClass().getName().startsWith("org.springframework.core.codec")) {
|
||||
Log logger = HttpLogging.forLog(((AbstractDecoder) decoder).getLogger());
|
||||
((AbstractDecoder) decoder).setLogger(logger);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -67,16 +67,15 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
|
||||
*/
|
||||
public EncoderHttpMessageWriter(Encoder<T> encoder) {
|
||||
Assert.notNull(encoder, "Encoder is required");
|
||||
initLogger(encoder);
|
||||
this.encoder = encoder;
|
||||
this.mediaTypes = MediaType.asMediaTypes(encoder.getEncodableMimeTypes());
|
||||
this.defaultMediaType = initDefaultMediaType(this.mediaTypes);
|
||||
initLogger(encoder);
|
||||
}
|
||||
|
||||
private void initLogger(Encoder<T> encoder) {
|
||||
private static void initLogger(Encoder<?> encoder) {
|
||||
if (encoder instanceof AbstractEncoder &&
|
||||
encoder.getClass().getPackage().getName().startsWith("org.springframework.core.codec")) {
|
||||
|
||||
encoder.getClass().getName().startsWith("org.springframework.core.codec")) {
|
||||
Log logger = HttpLogging.forLog(((AbstractEncoder) encoder).getLogger());
|
||||
((AbstractEncoder) encoder).setLogger(logger);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -215,15 +215,12 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
}
|
||||
|
||||
private String formatMappings(Class<?> userType, Map<Method, T> methods) {
|
||||
|
||||
String formattedType = Arrays.stream(userType.getPackage().getName().split("\\."))
|
||||
String formattedType = Arrays.stream(ClassUtils.getPackageName(userType).split("\\."))
|
||||
.map(p -> p.substring(0, 1))
|
||||
.collect(Collectors.joining(".", "", ".")) + userType.getSimpleName();
|
||||
|
||||
Function<Method, String> methodFormatter = method -> Arrays.stream(method.getParameterTypes())
|
||||
.map(Class::getSimpleName)
|
||||
.collect(Collectors.joining(",", "(", ")"));
|
||||
|
||||
return methods.entrySet().stream()
|
||||
.map(e -> {
|
||||
Method method = e.getKey();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -285,15 +285,12 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
}
|
||||
|
||||
private String formatMappings(Class<?> userType, Map<Method, T> methods) {
|
||||
|
||||
String formattedType = Arrays.stream(userType.getPackage().getName().split("\\."))
|
||||
String formattedType = Arrays.stream(ClassUtils.getPackageName(userType).split("\\."))
|
||||
.map(p -> p.substring(0, 1))
|
||||
.collect(Collectors.joining(".", "", ".")) + userType.getSimpleName();
|
||||
|
||||
Function<Method, String> methodFormatter = method -> Arrays.stream(method.getParameterTypes())
|
||||
.map(Class::getSimpleName)
|
||||
.collect(Collectors.joining(",", "(", ")"));
|
||||
|
||||
return methods.entrySet().stream()
|
||||
.map(e -> {
|
||||
Method method = e.getKey();
|
||||
|
||||
Reference in New Issue
Block a user