Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot and Flyway: file location with spring.flyway.locations is ignored

Spring Boot 1.5.11, Flyway 5.0.7 (also tried 5.1.1). The location specification is ignored. What am I missing here?

spring:
  profiles: db_h2
  datasource:settings
    platform: h2
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:log4jdbc:h2:mem:TEST;DB_CLOSE_ON_EXIT=FALSE
    driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
    hikari:
      maximum-pool-size: 5
      driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.H2Dialect
  flyway:
    locations: classpath:/flyway/h2,classpath:/flyway/common,classpath:/flyway/testdata
  h2:
    console:
      enabled: true
      path: /h2

Log excerpt shows that the right profile is picked up but the specified setting is not:

2018-06-05 08:24:48.282 DEBUG 13188 --- [           main] c.c.c.backend.config.Application         : Running with Spring Boot v1.5.11.RELEASE, Spring v5.0.5.RELEASE
2018-06-05 08:24:48.282  INFO 13188 --- [           main] c.c.c.backend.config.Application         : The following profiles are active: db_h2,logging_normal,http_insecure,credentials_insecure,option_create_sql_script
2018-06-05 08:24:52.240  INFO 13188 --- [           main] o.f.core.internal.util.VersionPrinter    : Flyway Community Edition 5.0.7 by Boxfuse
2018-06-05 08:24:52.414  INFO 13188 --- [           main] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:h2:mem:TEST (H2 1.4)
2018-06-05 08:24:52.431 DEBUG 13188 --- [           main] jdbc.sqltiming                           :  com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
1. CALL SCHEMA() 
 {executed in 5 msec}
2018-06-05 08:24:52.445 DEBUG 13188 --- [           main] org.flywaydb.core.Flyway                 : DDL Transactions Supported: false
2018-06-05 08:24:52.447 DEBUG 13188 --- [           main] org.flywaydb.core.Flyway                 : Schema: PUBLIC
2018-06-05 08:24:52.452 DEBUG 13188 --- [           main] o.f.core.internal.util.FeatureDetector   : Spring Jdbc available: true
2018-06-05 08:24:52.454 DEBUG 13188 --- [           main] o.f.c.i.c.SqlScriptFlywayCallback        : Scanning for SQL callbacks ...
2018-06-05 08:24:52.455 DEBUG 13188 --- [           main] o.f.c.i.u.s.classpath.ClassPathScanner   : Scanning for classpath resources at 'classpath:db/migration' (Prefix: '', Suffixes: '.sql')
2018-06-05 08:24:52.455 DEBUG 13188 --- [           main] o.f.c.i.u.s.classpath.ClassPathScanner   : Determining location urls for classpath:db/migration using ClassLoader sun.misc.Launcher$AppClassLoader@18b4aac2 ...
2018-06-05 08:24:52.506  WARN 13188 --- [           main] o.f.c.i.u.s.classpath.ClassPathScanner   : Unable to resolve location classpath:db/migration
like image 871
Arthur Avatar asked Jun 05 '18 06:06

Arthur


1 Answers

From the Spring Boot 1.5 documentation I would say that the correct property name is flyway.locations, without spring prefix. It differs between 1.5 and 2.0 branches.

like image 111
Nikem Avatar answered Sep 18 '22 12:09

Nikem