I am trying to connect to a service from a remote repo which has configuration to my application with Spring Cloud, for some reason I can't make it work.
The error I get:
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action: Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles default are currently active).
config-module/src/resources/some-service/some-service.yml:
spring:
jpa:
database: "PostgreSQL"
show-sql: "true"
properties:
hibernate:
dialect: "org.hibernate.dialect.PostgreSQLDialect"
datasource:
driver-class-name: "org.postgresql.Driver"
url: "jdbc:postgresql://database:5432/some-path"
username: "<some-user>"
password: "<some-password>"
validationQuery: "SELECT 1"
sql:
init:
platform: "postgres"
config-module/src/resources/application.yml:
server:
port: 8888
spring:
cloud:
config:
server:
encrypt:
enabled: true
key:
git:
uri: https://github.com/<some-config-repo>
searchPaths: <directory-in-config-repo>
username: <some-user>
password: <some-password>
some-service/src/resources/bootsrap.yml:
spring:
application:
name: <directory-in-config-repo>
profiles:
active:
default
cloud:
config:
uri: http://localhost:8888
I can run psql on cmd so there is no problem there.
I tried changing versions of pom files because I was using latest in all of them and thought maybe older versions would be more stable but no luck. I expect to reach the databasee page and my app to compile.
Exclude you auto config class :
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
Also also make sure database with name some-path
is exists