I am trying to develop a microservice and deployment for two different regions. Two different region using two different database. So for using that, I created one spring cloud config server and defined database property for two different profiles,
Here Is my spring cloud config server project details, Created config folder in src/main/resources and add two files,
bootstrap-vcu.properties file containing,
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost/milleTech_users
spring.datasource.username=postgres
spring.datasource.password=postgresql
bootstrap-sp.properties file containing,
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost/espace
spring.datasource.username=postgres
spring.datasource.password=postgresql
Application.properties containing,
server.port=8888
spring.profiles.active=native
Bootstrap.properties
spring.cloud.config.uri=localhost:8888
Folder structure for config server is as following,
And my pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
And created separate project for spring cloud config client,
Config client project application.properties file is like,
server.port=8080
spring.cloud.config.uri=localhost:8888
And launching client application like ,
java -jar -Dsping.profiles.active=vcu ConfigClient-0.0.1-SNAPSHOT.war
But getting error as
"Failed to auto-configure a DataSource: 'spring.datasource.url' is not
specified and no embedded datasource could be auto-configured"
Reason: Failed to determine a suitable driver class
Try to rename DbVcu.properties into application-DbVcu.properties and move it to src/main/ressources folder.