0

I have service S1 , S2 , S3 which share common database in config server so i configure below properties in config server properties file and all service read this configuration and initialized jpa repository. now i have service S4 which has different database so how to configure that service to initialized jpa repository.

spring.datasource.url=......
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.format_sql=true
pratik
  • 21
  • 4
  • You must not put the configuratoin in the common database code but in the services. – Simon Martinelli Jan 07 '20 at 12:16
  • I think you mean you want to configure multiple data sources? If so I suggest to take a look at the [documentation](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources). – Sanderr Jan 07 '20 at 12:29
  • Does this answer your question? [Spring Boot Configure and Use Two DataSources](https://stackoverflow.com/questions/30337582/spring-boot-configure-and-use-two-datasources) – RamPrakash Jan 07 '20 at 12:58

0 Answers0