Allow flyway loggers to be configured and provide SLF4J default

Add `spring.flyway.loggers` property which can be used to configure
Flyway loggers and has a default value of "slf4j".

Closes gh-35158
This commit is contained in:
Phillip Webb
2023-05-17 17:24:29 -07:00
parent 022004d780
commit cf95ae92ea
3 changed files with 30 additions and 1 deletions

View File

@@ -763,6 +763,21 @@ class FlywayAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(ResourceProviderCustomizer.class));
}
@Test
void loggers() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.run((context) -> assertThat(context.getBean(Flyway.class).getConfiguration().getLoggers())
.containsExactly("slf4j"));
}
@Test
void overrideLoggers() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.flyway.loggers=log4j2")
.run((context) -> assertThat(context.getBean(Flyway.class).getConfiguration().getLoggers())
.containsExactly("log4j2"));
}
@Test
void shouldRegisterResourceHints() {
RuntimeHints runtimeHints = new RuntimeHints();