alwyn
06/19/2023, 4:37 PMSpringApplication.from(xxxx::main).with(yyyy.class).run(args)
to copy the configuration of your main xxxx SpringBootApplication class and extend it with the configuration class yyyy.class
Specifying xxxx::main in Kotlin don't want to resolve in Intellij, but for Java it works. The argument for the .from
method is of type ThrowingConsumer
which neither the Java main or the Kotlin main functions match, yet it works for Java, but not Kotlin.
I guess the broader question is, can you get a function reference to fun main(..)
and how do you use it?Jacob
06/19/2023, 4:47 PMalwyn
06/19/2023, 8:52 PMpublic static SpringApplication.Augmented from(ThrowingConsumer<String[]> main) {
Assert.notNull(main, "Main must not be null");
return new Augmented(main, Collections.emptySet());
}
alwyn
06/19/2023, 8:53 PMalwyn
06/19/2023, 8:56 PMSpringApplication
.from(Application::main)
.with(TestApplication::class.java)
.run(*args)
The above is in the main function of TestApplicationalwyn
06/19/2023, 8:59 PMalwyn
06/19/2023, 9:34 PMalwyn
06/20/2023, 3:05 PM