https://kotlinlang.org logo
Title
x

xenoterracide

01/08/2019, 12:42 AM
I think this should work, but
Exception in thread "main" java.lang.NoSuchMethodException: com.potrero.Application.main([Ljava.lang.String;)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2476)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
package com.potrero

import org.apache.logging.log4j.LogManager
import org.springframework.beans.factory.getBeanProvider
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.info.BuildProperties
import org.springframework.boot.runApplication

@SpringBootApplication
open class Application

fun main(args: Array<String>) {
    val ctx = runApplication<Application>(*args)
    ctx.getBeanProvider<BuildProperties>().ifAvailable {
        LogManager.getLogger(Application::class.java).info("Starting {}", it.artifact)
    }
}
shouldn’t this kotlin class work to start spring boot?
s

Shawn

01/08/2019, 1:15 AM
#spring