Spring boot unable to determine jdbc url from datasouce (mysql)

Adrian Pascu :

I am trying to load a MySQL database into a spring boot application but when I start the application I am getting those error messages:

2018-07-17 13:46:31.426 WARN 2120 --- [ restartedMain] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: 'url' not set

Although I have set the url property in application.properties : spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase

Can anyone help me figure this one out?

Edit: Here is my Main class:

package com.randomsoft.checkoff;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class CheckoffApplication {

public static void main(String[] args) {
    SpringApplication.run(CheckoffApplication.class, args);
}
}
Kathirvel Subramanian :

can you try by removing @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})

also try to add all below jdbc properties,

spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase?verifyServerCertificate=false&useSSL=false&requireSSL=false
spring.datasource.username=<username>
spring.datasource.password=<password>
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=update

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=75305&siteId=1
Recommended