Y
Y
Yourmind2019-09-07 02:12:54
PostgreSQL
Yourmind, 2019-09-07 02:12:54

What is the cause of the error: Failed to configure a DataSource?

I have a posgres database named mydate. I want to connect to it in spring boot application. In settings project_name/src/main/resources/application.yml I write:
spring:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/mydate
username: test_user
password: qwerty
But still error: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
The base dependency and its subkey driver are:
spring-boot-starter-data-jpa
org.postgresql

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Osipov, 2019-09-07
@Shiftuia

Okay Google - spring yml datasource Opening the
first link on SO

spring:
  jpa:
    database: POSTGRESQL
    show-sql: true
    hibernate:
      ddl-auto: create-drop
  datasource:
    platform: postgres
    url: jdbc:postgresql://localhost:5432/mydb
    username: foo
    password: bar
    driverClassName: org.postgresql.Driver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question