From 960b03487556834bf81af57ffa321e4476f904a0 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 7 Sep 2022 09:07:29 +0200 Subject: [PATCH] Polish "Make sure Hazelcast shutdown logs are available" See gh-32184 --- .../autoconfigure/hazelcast/HazelcastServerConfiguration.java | 3 ++- .../hazelcast/HazelcastAutoConfigurationServerTests.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration.java index 6edd2d20d926..86bebd65851f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration.java @@ -51,6 +51,7 @@ class HazelcastServerConfiguration { static final String CONFIG_SYSTEM_PROPERTY = "hazelcast.config"; + static final String HAZELCAST_LOGGING_TYPE = "hazelcast.logging.type"; private static HazelcastInstance getHazelcastInstance(Config config) { @@ -126,7 +127,7 @@ HazelcastConfigCustomizer springManagedContextHazelcastConfigCustomizer(Applicat @Configuration(proxyBeanMethods = false) @ConditionalOnClass(org.slf4j.Logger.class) - static class LoggingHazelcastConfigCustomizerConfiguration { + static class HazelcastLoggingConfigCustomizerConfiguration { @Bean @Order(0) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java index 798eb9845f70..5833ed0a2b7a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java @@ -207,7 +207,7 @@ void autoConfiguredContextCanOverrideManagementContextUsingCustomizer() { } @Test - void configWithDefaultLoggingTypeSlf4j() { + void autoConfiguredConfigSetsHazelcastLoggingToSlf4j() { this.contextRunner.run((context) -> { Config config = context.getBean(HazelcastInstance.class).getConfig(); assertThat(config.getProperty(HazelcastServerConfiguration.HAZELCAST_LOGGING_TYPE)).isEqualTo("slf4j"); @@ -215,7 +215,7 @@ void configWithDefaultLoggingTypeSlf4j() { } @Test - void configWithExplicitLoggingType() { + void autoConfiguredConfigCanOverrideHazelcastLogging() { this.contextRunner.withUserConfiguration(HazelcastConfigWithJDKLogging.class).run((context) -> { Config config = context.getBean(HazelcastInstance.class).getConfig(); assertThat(config.getProperty(HazelcastServerConfiguration.HAZELCAST_LOGGING_TYPE)).isEqualTo("jdk");