flyway test extension 1.7.0 でプレースホルダーを使用しようとしています。flyway.properties でプレースホルダーを定義しました。
flyway.placeholders.schema_name=MYSCHEMA
私のSQLスクリプトは次のようになります:
create schema ${schema_name};
フライウェイ テストを実行すると、次のエラーが発生します。
117157 [main] DEBUG com.googlecode.flyway.core.migration.sql.SqlScript - Found statement at line 1: create schema ${schema_name};
117157 [main] DEBUG com.googlecode.flyway.core.migration.sql.SqlStatement - Executing SQL: create schema ${schema_name}
117157 [main] ERROR com.googlecode.flyway.core.migration.DbMigrator - com.googlecode.flyway.core.exception.FlywayException: Error executing statement at line 1: create schema ${schema_name}
117158 [main] ERROR com.googlecode.flyway.core.migration.DbMigrator - Caused by org.hsqldb.HsqlException: Unknown JDBC escape sequence: {: {schema_name}
117158 [main] DEBUG com.googlecode.flyway.core.migration.DbMigrator - Finished migrating to version 1.1 (execution time 00:00.005s)
そのため、プレースホルダーの置換が機能していないようです。ちなみに、flyway.properties ファイルは正常にロードされています (jdbc url などの他の値にも使用しています)。
誰かがここで何が問題なのか知っていますか?
EDIT1 Flyway クラスの configure メソッドが呼び出されていないようです。アプリケーション コンテキストに何かを追加する必要がありますか?
EDIT2私たちが見つけた1つの解決策は、アプリケーションコンテキストにプレースホルダーを設定することです:
<bean id="flyway" class="com.googlecode.flyway.core.Flyway"
depends-on="dataSourceRef">
<property name="dataSource" ref="dataSourceRef" />
<property name="placeholders" >
<map>
<entry key="schema_name" value="${flyway.placeholders.schema_name}" />
</map>
</property>
</bean>
しかし、私たちはまだより良い解決策を探しています...