From 30027791954dc660a92a9a2912038559381243f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 19 Oct 2022 18:44:46 +0200 Subject: [PATCH] Remove LogbackConfigurationAotContribution from native image Remove `LogbackConfigurationAotContribution` from the reachable code path from a native image POV. See gh-32793 --- .../boot/logging/logback/SpringBootJoranConfigurator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java index 3b47df87be..06ee187b3e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java @@ -56,6 +56,7 @@ import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContrib import org.springframework.beans.factory.aot.BeanFactoryInitializationCode; import org.springframework.boot.logging.LoggingInitializationContext; import org.springframework.core.CollectionFactory; +import org.springframework.core.NativeDetector; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -110,7 +111,7 @@ class SpringBootJoranConfigurator extends JoranConfigurator { @Override public void processModel(Model model) { super.processModel(model); - if (isAotProcessingInProgress()) { + if (!NativeDetector.inNativeImage() && isAotProcessingInProgress()) { getContext().putObject(BeanFactoryInitializationAotContribution.class.getName(), new LogbackConfigurationAotContribution(model, getModelInterpretationContext().getBeanDescriptionCache(),