应用程序属性
TM_ESCALATION_QUALIFICATION=SHIFT_LEADER
应用程序.java
@Value( "${TM_ESCALATION_QUALIFICATION}" )
String escalationQualification;
@Bean
InitializingBean printConfigurations(DataSource datasource) {
return () -> {
Flyway flyway = new Flyway();
flyway.setDataSource(datasource);
flyway.getPlaceholders().put( "ESCALATION_QUALIFICATION", escalationQualification );
flyway.migrate();
};
}
SQL 文件
insert into tm_qualification (ID, NAME, DELETABLE) values (sys_guid(), ${ESCALATION_QUALIFICATION}, 0);
当我使用具有默认扩展名的文件时,上面的工作正常,但是当我将文件作为.sql扩展名时出现以下错误。
错误
org.flywaydb.core.api.FlywayException: No value provided for placeholder expressions: ${ESCALATION_QUALIFICATION}. Check your configuration!
at org.flywaydb.core.internal.util.PlaceholderReplacer.checkForUnmatchedPlaceholderExpression(PlaceholderReplacer.java:101)
at org.flywaydb.core.internal.util.PlaceholderReplacer.replacePlaceholders(PlaceholderReplacer.java:78)
at org.flywaydb.core.internal.dbsupport.SqlScript.<init>(SqlScript.java:79)....