mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Adapt to changes in Logback include processing
Fixes gh-40491
This commit is contained in:
parent
86a3099782
commit
3c00bf367d
@ -107,6 +107,16 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|||||||
ruleStore.addTransparentPathPart("springProfile");
|
ruleStore.addTransparentPathPart("springProfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildModelInterpretationContext() {
|
||||||
|
super.buildModelInterpretationContext();
|
||||||
|
this.modelInterpretationContext.setConfiguratorSupplier(() -> {
|
||||||
|
SpringBootJoranConfigurator configurator = new SpringBootJoranConfigurator(this.initializationContext);
|
||||||
|
configurator.setContext(this.context);
|
||||||
|
return configurator;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
boolean configureUsingAotGeneratedArtifacts() {
|
boolean configureUsingAotGeneratedArtifacts() {
|
||||||
if (!new PatternRules(getContext()).load()) {
|
if (!new PatternRules(getContext()).load()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -83,6 +83,14 @@ class SpringBootJoranConfiguratorTests {
|
|||||||
assertThat(this.output).contains("Hello");
|
assertThat(this.output).contains("Hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void profileInIncludeActive() throws Exception {
|
||||||
|
this.environment.setActiveProfiles("production");
|
||||||
|
initialize("profile-in-include.xml");
|
||||||
|
this.logger.trace("Hello");
|
||||||
|
assertThat(this.output).contains("Hello");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void multipleNamesFirstProfileActive() throws Exception {
|
void multipleNamesFirstProfileActive() throws Exception {
|
||||||
this.environment.setActiveProfiles("production");
|
this.environment.setActiveProfiles("production");
|
||||||
@ -203,6 +211,13 @@ class SpringBootJoranConfiguratorTests {
|
|||||||
assertThat(this.context.getProperty("MYCHECK")).isNull();
|
assertThat(this.context.getProperty("MYCHECK")).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void springPropertyInInclude() throws Exception {
|
||||||
|
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.example-property=test");
|
||||||
|
initialize("property-in-include.xml");
|
||||||
|
assertThat(this.context.getProperty("MINE")).isEqualTo("test");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void addsAotContributionToContextDuringAotProcessing() throws Exception {
|
void addsAotContributionToContextDuringAotProcessing() throws Exception {
|
||||||
withSystemProperty("spring.aot.processing", "true", () -> {
|
withSystemProperty("spring.aot.processing", "true", () -> {
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
<included>
|
||||||
|
<springProfile name="production">
|
||||||
|
<logger name="org.springframework.boot.logging.logback" level="TRACE" />
|
||||||
|
</springProfile>
|
||||||
|
</included>
|
@ -0,0 +1,3 @@
|
|||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="MINE" source="my.example-property" defaultValue="default-test" />
|
||||||
|
</included>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||||
|
<include resource="org/springframework/boot/logging/logback/include-with-profile.xml" />
|
||||||
|
</configuration>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||||
|
<include resource="org/springframework/boot/logging/logback/include-with-property.xml" />
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue
Block a user