Updated Flyway configuration.
Change-Id: Id32ef35f47bc190220688086c50be2a7a36a88c4
diff --git a/core/pom.xml b/core/pom.xml
index 53a7679..59a689b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -12,6 +12,7 @@
<jersey.version>1.19.4</jersey.version>
<jetty.version>9.4.34.v20201102</jetty.version>
<hibernate.version>5.4.25.Final</hibernate.version>
+ <flyway.version>7.4.0</flyway.version>
<log4j.version>2.13.3</log4j.version>
</properties>
@@ -179,7 +180,7 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
- <version>4.0</version>
+ <version>${flyway.version}</version>
</dependency>
<!-- Logging -->
@@ -192,6 +193,12 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
@@ -204,8 +211,8 @@
<version>${log4j.version}</version>
<exclusions>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -249,20 +256,20 @@
<artifactId>jetty-servlet</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
</exclusion>
<exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
<exclusion>
- <groupId>log4j</groupId>
- <artifactId>apache-log4j-extras</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jul</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -311,12 +318,12 @@
<artifactId>sqlite-jdbc</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index c1da94b..0883b8e 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -107,17 +107,20 @@
</bean>
<!-- to configure database for sqlite, mysql, etc. migrations -->
- <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <bean id="flywayConfig" class="org.flywaydb.core.api.configuration.ClassicConfiguration">
<property name="baselineOnMigrate" value="true" />
<!-- <property name="validateOnMigrate" value="false" /> -->
<!-- <property name="cleanOnValidationError" value="true" /> -->
- <property name="locations" value="${jdbc.schemaPath}" />
+ <property name="locations" value="#{'${jdbc.schemaPath}'.split(',')}"/>
<!-- <property name="dataSource" ref="dataSource" /> -->
<property name="dataSource" ref="sqliteDataSource" />
<!-- <property name="dataSource" ref="c3p0DataSource" /> -->
</bean>
-
+
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <constructor-arg ref="flywayConfig"/>
+ </bean>
<bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient">
<constructor-arg index="0" ref="dataSource" />
@@ -126,7 +129,8 @@
</bean>
<bean id="entityManagerFactory"
- class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
+ depends-on="flyway">
<!-- <property name="dataSource" ref="dataSource" /> -->
<property name="dataSource" ref="sqliteDataSource" />
<!-- <property name="dataSource" ref="c3p0DataSource" /> -->
diff --git a/full/src/main/resources/properties/jdbc.properties b/full/src/main/resources/properties/jdbc.properties
index 7025240..026ad0e 100644
--- a/full/src/main/resources/properties/jdbc.properties
+++ b/full/src/main/resources/properties/jdbc.properties
@@ -22,4 +22,4 @@
jdbc.username=pc
jdbc.password=pc
# db.insert contains test data, omit it in production setting
-jdbc.schemaPath=db.sqlite, db.predefined
+jdbc.schemaPath=db/sqlite, db/predefined
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index b9f5e07..d17718c 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -97,16 +97,20 @@
</bean>
<!-- to configure database for sqlite, mysql, etc. migrations -->
- <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <bean id="flywayConfig" class="org.flywaydb.core.api.configuration.ClassicConfiguration">
<!-- drop existing tables and create new tables -->
<property name="validateOnMigrate" value="true" />
<property name="cleanOnValidationError" value="true" />
-
<property name="baselineOnMigrate" value="false" />
- <property name="locations" value="${jdbc.schemaPath}" />
+ <property name="locations" value="#{'${jdbc.schemaPath}'.split(',')}"/>
<property name="dataSource" ref="sqliteDataSource" />
<!-- <property name="dataSource" ref="dataSource" /> -->
</bean>
+
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <constructor-arg ref="flywayConfig"/>
+ </bean>
+
<bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient">
<!-- <constructor-arg index="0" ref="dataSource" /> -->
diff --git a/full/src/test/resources/test-jdbc.properties b/full/src/test/resources/test-jdbc.properties
index da5fd57..48f51f5 100644
--- a/full/src/test/resources/test-jdbc.properties
+++ b/full/src/test/resources/test-jdbc.properties
@@ -7,4 +7,4 @@
#jdbc.url=jdbc:sqlite:testDB.sqlite
jdbc.username=pc
jdbc.password=pc
-jdbc.schemaPath=classpath:db.sqlite, db.test, db.predefined
\ No newline at end of file
+jdbc.schemaPath=classpath:db/sqlite,db/predefined,db/test
\ No newline at end of file
diff --git a/lite/src/main/resources/lite-config.xml b/lite/src/main/resources/lite-config.xml
index 637977f..def33a2 100644
--- a/lite/src/main/resources/lite-config.xml
+++ b/lite/src/main/resources/lite-config.xml
@@ -71,14 +71,18 @@
<!--<property name="initialSize" value="2"/> -->
<!--<property name="poolPreparedStatements" value="true"/> -->
</bean>
-
- <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <bean id="flywayConfig" class="org.flywaydb.core.api.configuration.ClassicConfiguration">
<property name="baselineOnMigrate" value="true" />
<!-- <property name="validateOnMigrate" value="false" /> -->
<!-- <property name="cleanOnValidationError" value="true" /> -->
- <property name="locations" value="${jdbc.schemaPath}" />
+ <property name="locations" value="#{'${jdbc.schemaPath}'.split(',')}"/>
<property name="dataSource" ref="sqliteDataSource" />
</bean>
+
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <constructor-arg ref="flywayConfig"/>
+ </bean>
+
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
diff --git a/lite/src/test/resources/test-config.xml b/lite/src/test/resources/test-config.xml
index 952d5d1..a68d8b1 100644
--- a/lite/src/test/resources/test-config.xml
+++ b/lite/src/test/resources/test-config.xml
@@ -70,13 +70,17 @@
</property>
</bean>
- <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
- <property name="baselineOnMigrate" value="true" />
+ <bean id="flywayConfig" class="org.flywaydb.core.api.configuration.ClassicConfiguration">
+ <property name="baselineOnMigrate" value="true" />
<!-- <property name="validateOnMigrate" value="false" /> -->
<!-- <property name="cleanOnValidationError" value="true" /> -->
- <property name="locations" value="${jdbc.schemaPath}" />
+ <property name="locations" value="#{'${jdbc.schemaPath}'.split(',')}"/>
<property name="dataSource" ref="sqliteDataSource" />
</bean>
+
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <constructor-arg ref="flywayConfig"/>
+ </bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">