首页 > 解决方案 > Spring Boot“Hello World”示例给出了运行方法异常

问题描述

在收到质疑我智力的暗示性评论之前,我会说我只是按照 Spring 官方网站 ( https://spring.io/guides/gs/rest-service/ ) 上提供的指导进行操作。作为奖励,我收到了一个错误。

不需要定义文档中未说明的任何内容,Gradle 构建是复制粘贴的,那么问题出在哪里?

在此处输入图像描述

构建.gradle

    buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
    }
}

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

bootJar {
    baseName = 'gs-rest-service'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

标签: eclipsespring-bootgradle

解决方案


推荐阅读