程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了找不到参数springBoot()的方法-使用Kotlin的Spring Boot大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决找不到参数springBoot()的方法-使用Kotlin的Spring Boot?

开发过程中遇到找不到参数springBoot()的方法-使用Kotlin的Spring Boot的问题如何解决?下面主要结合日常开发的经验,给出你关于找不到参数springBoot()的方法-使用Kotlin的Spring Boot的解决方法建议,希望对你解决找不到参数springBoot()的方法-使用Kotlin的Spring Boot有所启发或帮助;

你需要:

apply plugin: 'spring-boot'

以及:)

导入依赖项还不够。

解决方法

我尝试使用Kotlin创建第一个Spring Boot应用程序。因此,也许我犯了一些明显的错误或类似的错误。

我的 gradle.build 是:

buildscript {
    ext.kotlin_version = '1.0.5-2'
    ext.spring_boot_version = '1.4.2.RELEASE'
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
    }
}

apply plugin: 'idea'
apply plugin: 'kotlin'
apply plugin: 'application'

jar {
    basename = 'rest-voter'
    version = '0.1.0'
}

springBoot {
    mainClass = 'ru.hixon.Application'
}

repositories {
    jcenter()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile "org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE"
    TESTCompile 'junit:junit'
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.13'
}

错误 是:

C:\Users\Desktop\rest-voter>gradlew build

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Desktop\rest-voter\build.gradle' line: 22

* what went wrong:
A problem occurred evaluaTing root project 'rest-voter'.
> Could not find method springBoot() for arguments [build_3594if1jtm90vgb7v8evp206i$_run_closure2@459003a0] on root project 'rest-voter'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

@R_245_10586@l time: 12.351 secs

我的 主要课程 是:

package ru.hixon

import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication

@SpringBootApplication
open class Application {

}

fun main(args: Array<String>) {
    SpringApplication.run(Application::class.java,*args)
}

而这里是我的应用程序的完整的代码。

大佬总结

以上是大佬教程为你收集整理的找不到参数springBoot()的方法-使用Kotlin的Spring Boot全部内容,希望文章能够帮你解决找不到参数springBoot()的方法-使用Kotlin的Spring Boot所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。