From a5367b52c27d14eabb9af2f553651b1c68451975 Mon Sep 17 00:00:00 2001 From: arefbehboudi Date: Mon, 9 Sep 2024 16:13:35 +0330 Subject: [PATCH 1/2] Polish See gh-42192 --- .../java/org/springframework/boot/json/JsonValueWriter.java | 5 +---- .../boot/logging/log4j2/Log4J2LoggingSystem.java | 4 +--- .../reactive/ApplicationContextServerWebExchangeMatcher.java | 2 +- .../security/servlet/ApplicationContextRequestMatcher.java | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java index be0535f7a9..00194b5504 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/JsonValueWriter.java @@ -103,12 +103,9 @@ class JsonValueWriter { else if (value instanceof Map map) { writeObject(map::forEach); } - else if (value instanceof Number) { + else if (value instanceof Number || value instanceof Boolean) { append(value.toString()); } - else if (value instanceof Boolean) { - append(Boolean.TRUE.equals(value) ? "true" : "false"); - } else { writeString(value); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java index 21d4d47a39..694c8f5cba 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java @@ -238,9 +238,7 @@ public class Log4J2LoggingSystem extends AbstractLoggingSystem { private void load(LoggingInitializationContext initializationContext, String location, LogFile logFile) { List overrides = getOverrides(initializationContext); - if (initializationContext != null) { - applySystemProperties(initializationContext.getEnvironment(), logFile); - } + applySystemProperties(initializationContext.getEnvironment(), logFile); loadConfiguration(location, logFile, overrides); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java index 88ea38ca56..11dda128d2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java @@ -29,7 +29,7 @@ import org.springframework.web.server.ServerWebExchange; /** * {@link ApplicationContext} backed {@link ServerWebExchangeMatcher}. Can work directly * with the {@link ApplicationContext}, obtain an existing bean or - * {@link AutowireCapableBeanFactory#createBean(Class, int, boolean) create a new bean} + * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} * that is autowired in the usual way. * * @param the type of the context that the match method actually needs to use. Can be diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java index 0f2d9e3858..d96253c707 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java @@ -30,7 +30,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils; /** * {@link ApplicationContext} backed {@link RequestMatcher}. Can work directly with the * {@link ApplicationContext}, obtain an existing bean or - * {@link AutowireCapableBeanFactory#createBean(Class, int, boolean) create a new bean} + * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} * that is autowired in the usual way. * * @param the type of the context that the match method actually needs to use. Can be From ece5c6fe9e613831d2f0b2dd67ee4f7aa3828c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 10 Sep 2024 12:42:23 +0200 Subject: [PATCH 2/2] Polish contribution See gh-42192 --- .../ApplicationContextServerWebExchangeMatcher.java | 6 +++--- .../security/servlet/ApplicationContextRequestMatcher.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java index 11dda128d2..685c49ae1b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 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. @@ -29,8 +29,8 @@ import org.springframework.web.server.ServerWebExchange; /** * {@link ApplicationContext} backed {@link ServerWebExchangeMatcher}. Can work directly * with the {@link ApplicationContext}, obtain an existing bean or - * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} - * that is autowired in the usual way. + * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} that is + * autowired in the usual way. * * @param the type of the context that the match method actually needs to use. Can be * an {@link ApplicationContext} or a class of an {@link ApplicationContext#getBean(Class) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java index d96253c707..2005f5b6f2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 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. @@ -30,8 +30,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils; /** * {@link ApplicationContext} backed {@link RequestMatcher}. Can work directly with the * {@link ApplicationContext}, obtain an existing bean or - * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} - * that is autowired in the usual way. + * {@link AutowireCapableBeanFactory#createBean(Class) create a new bean} that is + * autowired in the usual way. * * @param the type of the context that the match method actually needs to use. Can be * an {@link ApplicationContext} or a class of an {@link ApplicationContext#getBean(Class)