Spring Boot和Flyway:忽略spring.flyway.locations的文件位置

时间:2018-06-05 06:36:00

标签: spring-boot flyway

Spring Boot 1.5.11,Flyway 5.0.7(也尝试过5.1.1)。位置规范被忽略。我在这里缺少什么?

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

日志摘录显示已选择正确的配置文件,但指定的设置不是:

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

1 个答案:

答案 0 :(得分:6)

Spring Boot 1.5 documentation我会说正确的属性名称是flyway.locations,没有spring前缀。它在1.5和2.0分支之间有所不同。

相关问题