Stack Exchange
Spring boot + kotlin runApplication<MyApplication>(*args) can not start
import org.springframework.boot.runApplication
import org.springframework.boot.SpringApplication

@SpringBootApplication
open  class MyApplication

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


Error: unable to find or unable to load the main class

Why can't that run, but this can?
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.SpringApplication

@SpringBootApplication
open class MyApplication

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


You are missing following import in your Kotlin code:
import org.springframework.boot.autoconfigure.SpringBootApplication

Adding it should fix the problem.
On the other hand, this import is not necessary:
import org.springframework.boot.SpringApplication

