committed by
Michael Minella
parent
b03f8398a7
commit
6c47223859
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.task.configuration;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
import org.springframework.jdbc.support.MetaDataAccessException;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Utility for initializing the Task Repository's datasource. If a single
|
||||
@@ -63,6 +64,9 @@ public final class TaskRepositoryInitializer implements InitializingBean {
|
||||
@Value("${spring.cloud.task.initialize.enable:true}")
|
||||
private boolean taskInitializationEnable;
|
||||
|
||||
@Value("${spring.cloud.task.tablePrefix:#{null}}")
|
||||
private String tablePrefix;
|
||||
|
||||
public TaskRepositoryInitializer(){
|
||||
}
|
||||
|
||||
@@ -86,7 +90,9 @@ public final class TaskRepositoryInitializer implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (dataSource != null && taskInitializationEnable) {
|
||||
if (dataSource != null &&
|
||||
taskInitializationEnable &&
|
||||
!StringUtils.hasText(this.tablePrefix)) {
|
||||
String platform = getDatabaseType(dataSource);
|
||||
if ("hsql".equals(platform)) {
|
||||
platform = "hsqldb";
|
||||
|
||||
Reference in New Issue
Block a user