47.3.1 runApplication

Spring Boot提供了用runApplication<FooApplication>(*args)运行应用的惯用方式。如下所示:

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class FooApplication

fun main(args: Array<String>) {
    runApplication<FooApplication>(*args)
}

这是SpringApplication.run(FooApplication::class.java, *args)的替代品。它也允许自定义应用。如下所示:

runApplication<FooApplication>(*args) {
    setBannerMode(OFF)
}

最后更新于