How to define a Shared DataSource in Spring Cloud Config

696 views Asked by At

Would it be possible to set up a DataSource using Spring Cloud in which open JDBC connections could be injected into all of my Spring Boot applications?

Something kind of like a JNDI server lookup? If so, can someone provide some examples or a description on how to use this type of configuration?

2

There are 2 answers

0
Dave Syer On BEST ANSWER

You could use a Spring Cloud bootstrap configuration to create a DataSource. I don't see much value in doing it that way over a normal Spring Boot autoconfiguration though. Link: http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-developing-auto-configuration.

0
Carlos Alberto On

One solution I found out was to set all datasources info into the properties files which will supplied by Spring Cloud Config Server to applications clients. So the aplications clients which creates DataSources gets from remote properties those values.