TSK-1400: H2 in server mode for rest spring example

This commit is contained in:
Joerg Heffner 2020-09-28 14:03:30 +02:00 committed by Mustapha Zorgati
parent 654dc6b2cb
commit f50e5ef64a
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package pro.taskana.rest;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.h2.tools.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -31,4 +33,11 @@ public class ExampleRestConfiguration {
public SampleDataGenerator generateSampleData(DataSource dataSource) {
return new SampleDataGenerator(dataSource, schemaName);
}
@Bean(initMethod = "start", destroyMethod = "stop")
public Server inMemoryH2DatabaseaServer() throws SQLException {
return Server.createTcpServer(
"-tcp", "-tcpAllowOthers", "-tcpPort", "9090");
}
}

View File

@ -5,7 +5,7 @@ server.servlet.context-path=/taskana
######## Taskana DB #######
######## h2 configuration ########
spring.datasource.url=jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0
spring.datasource.url=jdbc:h2:mem:taskana;IGNORECASE=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_MODE=0
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=sa