Browse Source

Merge branch '3.2.x'

pull/40023/merge
Phillip Webb 2 years ago
parent
commit
f7397b9557
  1. 2
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java
  2. 27
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/service/connection/ConnectionDetailsFactories.java
  3. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
  4. 8
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java
  5. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java
  6. 1
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/GracefulShutdown.java

2
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java

@ -135,7 +135,7 @@ final class PulsarPropertiesMapper { @@ -135,7 +135,7 @@ final class PulsarPropertiesMapper {
try {
return sortedParams.entrySet()
.stream()
.map((e) -> "\"%s\":\"%s\"".formatted(e.getKey(), e.getValue()))
.map((entry) -> "\"%s\":\"%s\"".formatted(entry.getKey(), entry.getValue()))
.collect(Collectors.joining(",", "{", "}"));
}
catch (Exception ex) {

27
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/service/connection/ConnectionDetailsFactories.java

@ -122,28 +122,11 @@ public class ConnectionDetailsFactories { @@ -122,28 +122,11 @@ public class ConnectionDetailsFactories {
@SuppressWarnings("unchecked")
private static <S, D extends ConnectionDetails> Registration<S, D> get(ConnectionDetailsFactory<S, D> factory) {
ResolvableType type = ResolvableType.forClass(ConnectionDetailsFactory.class, factory.getClass());
Class<?>[] generics = resolveGenerics(type);
if (generics != null) {
return new Registration<>((Class<S>) generics[0], (Class<D>) generics[1], factory);
}
return null;
}
/**
* Resolve the generics of the given {@link ResolvableType} or {@code null} if any
* of them cannot be resolved.
* @param type the type to inspect
* @return the resolved generics if they can be loaded from the classpath,
* {@code null} otherwise
*/
private static Class<?>[] resolveGenerics(ResolvableType type) {
Class<?>[] resolvedGenerics = type.resolveGenerics();
for (Class<?> genericRawType : resolvedGenerics) {
if (genericRawType == null) {
return null;
}
}
return resolvedGenerics;
Class<?>[] generics = type.resolveGenerics();
Class<S> sourceType = (Class<S>) generics[0];
Class<D> connectionDetailsType = (Class<D>) generics[1];
return (sourceType != null && connectionDetailsType != null)
? new Registration<>(sourceType, connectionDetailsType, factory) : null;
}
}

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java

@ -569,7 +569,6 @@ class RabbitAutoConfigurationTests { @@ -569,7 +569,6 @@ class RabbitAutoConfigurationTests {
Object virtualThread = ReflectionTestUtils.getField(taskExecutor, "virtualThreadFactory");
Thread threadCreated = ((ThreadFactory) virtualThread).newThread(mock(Runnable.class));
assertThat(threadCreated.getName()).containsPattern("rabbit-simple-[0-9]+");
});
}
@ -586,7 +585,6 @@ class RabbitAutoConfigurationTests { @@ -586,7 +585,6 @@ class RabbitAutoConfigurationTests {
Object virtualThread = ReflectionTestUtils.getField(taskExecutor, "virtualThreadFactory");
Thread threadCreated = ((ThreadFactory) virtualThread).newThread(mock(Runnable.class));
assertThat(threadCreated.getName()).containsPattern("rabbit-direct-[0-9]+");
});
}

8
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java

@ -97,11 +97,11 @@ class SpringApplicationBannerPrinter { @@ -97,11 +97,11 @@ class SpringApplicationBannerPrinter {
private String createStringFromBanner(Banner banner, Environment environment, Class<?> mainApplicationClass)
throws UnsupportedEncodingException {
String charset = environment.getProperty("spring.banner.charset", StandardCharsets.UTF_8.name());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintStream printStream = new PrintStream(baos, false, charset)) {
banner.printBanner(environment, mainApplicationClass, printStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try (PrintStream out = new PrintStream(byteArrayOutputStream, false, charset)) {
banner.printBanner(environment, mainApplicationClass, out);
}
return baos.toString(charset);
return byteArrayOutputStream.toString(charset);
}
/**

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java

@ -62,8 +62,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> { @@ -62,8 +62,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
ConfigurationProperty property = source.getConfigurationProperty(name);
if (property != null && !hasDescendants) {
getContext().setConfigurationProperty(property);
Object result = property.getValue();
result = getContext().getPlaceholdersResolver().resolvePlaceholders(result);
Object result = getContext().getPlaceholdersResolver().resolvePlaceholders(property.getValue());
return getContext().getConverter().convert(result, target);
}
source = source.filter(name::isAncestorOf);

1
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/GracefulShutdown.java

@ -104,7 +104,6 @@ final class GracefulShutdown { @@ -104,7 +104,6 @@ final class GracefulShutdown {
}
}
}
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();

Loading…
Cancel
Save