Updated to files to fit the Standard.
This commit is contained in:
@@ -20,7 +20,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.task.configuration.EnableTask;
|
||||
|
||||
|
||||
/**
|
||||
* @author Michael Minella
|
||||
*/
|
||||
|
||||
@@ -33,4 +33,5 @@ public class CustomTaskConfigurer extends DefaultTaskConfigurer {
|
||||
public CustomTaskConfigurer(@Qualifier("secondDataSource") DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,15 +36,12 @@ public class EmbeddedDataSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.setType(EmbeddedDatabaseType.HSQL)
|
||||
.build();
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource secondDataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.setType(EmbeddedDatabaseType.H2)
|
||||
.build();
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
|
||||
/**
|
||||
* Creates two data sources that use external databases.
|
||||
*
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@@ -52,20 +53,19 @@ public class ExternalDataSourceConfiguration {
|
||||
|
||||
@Bean(name = "springDataSource")
|
||||
@Primary
|
||||
public DataSource dataSource(@Qualifier("springDataSourceProperties")DataSourceProperties springDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(springDataSourceProperties.getDriverClassName()).
|
||||
url(springDataSourceProperties.getUrl()).
|
||||
password(springDataSourceProperties.getPassword()).
|
||||
username(springDataSourceProperties.getUsername()).
|
||||
build();
|
||||
public DataSource dataSource(
|
||||
@Qualifier("springDataSourceProperties") DataSourceProperties springDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(springDataSourceProperties.getDriverClassName())
|
||||
.url(springDataSourceProperties.getUrl()).password(springDataSourceProperties.getPassword())
|
||||
.username(springDataSourceProperties.getUsername()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource secondDataSource(@Qualifier("secondDataSourceProperties") DataSourceProperties secondDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(secondDataSourceProperties.getDriverClassName()).
|
||||
url(secondDataSourceProperties.getUrl()).
|
||||
password(secondDataSourceProperties.getPassword()).
|
||||
username(secondDataSourceProperties.getUsername()).
|
||||
build();
|
||||
public DataSource secondDataSource(
|
||||
@Qualifier("secondDataSourceProperties") DataSourceProperties secondDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(secondDataSourceProperties.getDriverClassName())
|
||||
.url(secondDataSourceProperties.getUrl()).password(secondDataSourceProperties.getPassword())
|
||||
.username(secondDataSourceProperties.getUsername()).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SampleCommandLineRunner implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
System.out.println("There are " + this.dataSources.size() +
|
||||
" DataSources within this application");
|
||||
System.out.println("There are " + this.dataSources.size() + " DataSources within this application");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user