Added a sample that illustrates using multiple DataSources
This PR adds a sample that illustrates the use of multiple DataSources in a single Spring Cloud Task application. Resolves #413 Updated based on code review
This commit is contained in:
committed by
Glenn Renfro
parent
486ef0dec3
commit
09ff552b8d
29
spring-cloud-task-samples/multiple-datasources/README.adoc
Normal file
29
spring-cloud-task-samples/multiple-datasources/README.adoc
Normal file
@@ -0,0 +1,29 @@
|
||||
= Multiple DataSources Sample Task
|
||||
|
||||
This is a Spring Boot application that utilizes two DataSources and explicitly configures
|
||||
which one to be used for the Spring Cloud Task repository.
|
||||
|
||||
== Requirements:
|
||||
|
||||
* Java 8 or Above
|
||||
|
||||
== Classes:
|
||||
|
||||
* `MultipleDataSourcesApplication` - the Spring Boot Main Application.
|
||||
* `SampleCommandLineRunner` - the `CommandLineRunner` implementation for this task. It outputs the number of `DataSource` beans found in the context (should be 2).
|
||||
* `DataSourceConfiguration` - Configures two `DataSource` beans.
|
||||
* `CustomTaskConfigurer` - Uses a Spring `@Qualifier` to specify the correct `DataSource` to use.
|
||||
|
||||
== Build:
|
||||
|
||||
[source,shell,indent=2]
|
||||
----
|
||||
$ mvn clean package
|
||||
----
|
||||
|
||||
== Run:
|
||||
|
||||
[source,shell,indent=2]
|
||||
----
|
||||
$ java -jar target/multiple-datasources-2.0.0.RC1.jar
|
||||
----
|
||||
Reference in New Issue
Block a user