Skip to content

Commit 4d42934

Browse files
committed
Fix Flyway autoconfigure
In Spring Boot 4.0, auto-configurations were extracted from the monolithic spring-boot-autoconfigure module into separate modules. Having flyway-core on the classpath is no longer enough — the Flyway auto-configuration class is now in a separate module that needs to be included in the dependencies.
1 parent 21e3ac7 commit 4d42934

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

development.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ print_usage() {
136136
test
137137
Run tests locally.
138138
139+
run
140+
Run the application locally.
141+
139142
stop
140143
Stop Docker containers.
141144
@@ -174,6 +177,10 @@ case $COMMAND in
174177
run_tests
175178
;;
176179

180+
run)
181+
mvn spring-boot:run -Pdev
182+
;;
183+
177184
stop)
178185
stop_all
179186
;;

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@
370370
<artifactId>postgresql</artifactId>
371371
</dependency>
372372
<dependency>
373-
<groupId>org.flywaydb</groupId>
374-
<artifactId>flyway-core</artifactId>
373+
<groupId>org.springframework.boot</groupId>
374+
<artifactId>spring-boot-starter-flyway</artifactId>
375375
</dependency>
376376
<dependency>
377377
<groupId>org.flywaydb</groupId>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package fi.hsl.jore4.auth
2+
3+
import org.junit.jupiter.api.Assertions.assertNotNull
4+
import org.junit.jupiter.api.Tag
5+
import org.junit.jupiter.api.Test
6+
7+
@Tag("unitTest")
8+
class FlywayAutoConfigurationPresentTest {
9+
10+
@Test
11+
fun `flyway auto-configuration class is on the classpath`() {
12+
val clazz = Class.forName("org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration")
13+
assertNotNull(clazz, "FlywayAutoConfiguration must be on the classpath via spring-boot-starter-flyway")
14+
}
15+
}

0 commit comments

Comments
 (0)