TaskRepositoryInitializer now uses TaskConfigurer to determine the datasource

resolves #405
This commit is contained in:
Glenn Renfro
2018-03-09 13:10:02 -05:00
parent a2a9d598e7
commit 0915dc6dfe
3 changed files with 122 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,10 +114,9 @@ public class SimpleTaskConfiguration {
@Bean
public TaskRepositoryInitializer taskRepositoryInitializer() {
TaskRepositoryInitializer taskRepositoryInitializer = new TaskRepositoryInitializer();
if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) {
DataSource next = this.dataSources.iterator().next();
taskRepositoryInitializer.setDataSource(next);
DataSource initializerDataSource = getDefaultConfigurer().getTaskDataSource();
if(initializerDataSource != null) {
taskRepositoryInitializer.setDataSource(initializerDataSource);
}
return taskRepositoryInitializer;