Describe the bug
According to the official documentation, in order to let Spring Cloud Config Server use JDBC backend, I only need to add the spring-jdbc
dependency and run it with a jdbc
active profile.
However, it appears that by adding only the spring-jdbc
dependency and run the config server with a jdbc
profile, it still tries to use Git, and since the app does not have Git config properties, it fails to start.
Instead, if I use the spring-boot-starter-data-jpa
dependency which of course includes spring-jdbc
(and a few more) and run the config server with a jdbc
profile (this is still required as per testing), it connects to the database and the app can start.
***************************
APPLICATION FAILED TO START
***************************
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration. If you have set spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
Samples
I have set up a minimal project with multiple branches: spring-cloud-config-server-jdbc-test
Success? | Branch | Link |
---|---|---|
No | fail-using-spring-jdbc |
spring-cloud-config-server-jdbc-test - fail-using-spring-jdbc |
Yes | ok-using-starter-data-jpa |
spring-cloud-config-server-jdbc-test - ok-using-starter-data-jpa |
How to start
Run the run.bat
script.
- It will run a
mysql
Docker container with the database name that matches my Spring configurations. - Then it will build and run the config server.
(There is no schema initialization because this is not necessary in reproduction of this issue.)
Comment From: ryanjbaxter
Can you try using spring-boot-starter-data-jdbc
?
Comment From: blackr1234
Can you try using
spring-boot-starter-data-jdbc
?
Thanks for your suggestion. This works. Umm, may I know if the documentation actually refers to this dependency?