Gradle - не удалось определить подходящий класс водителя - PullRequest
0 голосов
/ 29 декабря 2018

Я новичок в Spring-boot и хотел создать приложение с использованием Eclipse, Spring и Gradle.После создания «Spring Starter Project» мне не удалось запустить приложение.Трассировка говорит:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-30 19:26:36.732 ERROR 3483 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

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 (no profiles are currently active).

Это мой файл "build.gradle":

buildscript {
    ext {
        springBootVersion = '2.1.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    implementation('org.springframework.boot:spring-boot-starter-web')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

Ответы [ 2 ]

0 голосов
/ 08 мая 2019

В моем случае файл application.properties был в src/main/resources/static, перемещение его на src/main/resources устранило ошибку

0 голосов
/ 30 декабря 2018

Добавьте реализацию ('com.h2database.h2') в ваши зависимости gradle.По умолчанию весенняя загрузка автоматически настраивает h2 с этим URL-адресом базы данных "jdbc: h2: mem: testdb"

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...