Ich versuche, eine MySQL-Datenbank in eine Spring-Boot-Anwendung zu laden, aber wenn ich die Anwendung starte, erhalte ich folgende Fehlermeldungen:
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
Obwohl ich die URL-Eigenschaft in application.properties
eingestellt habe: spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase
Kann mir jemand helfen, das herauszufinden?
Edit: Hier ist meine Hauptklasse:
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);
}
}
können Sie versuchen, indem Sie entfernen. @EnableAutoConfiguration (exclude = {DataSourceAutoConfiguration.class})
versuchen Sie auch, alle unten aufgeführten Jdbc-Eigenschaften hinzuzufügen.
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
versuchen Sie einfach, diese Zeile in Ihre Config-Klasse einzufügen
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
Sie sollten die Eigenschaftsdatei benennen: application.properties
oder application.yml