I have:
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=Europe/Madrid
spring.datasource.username=root
spring.datasource.password=secret
spring.jpa.hibernate.ddl-auto=update
and It works fine.
But when I try to do it this way:
spring:
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?serverTimezone=Europe/Madrid
username: root
password: secret
jpa:
hibernate:
ddl-auto: update
It fails with:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
I assume it is a silly syntax error, but I can't notice where it is.
If you are going to use the YAML syntax, you need to specify it by changing the name of the file from
application.properties
toapplication.yml
.