Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ inline fun <reified T : Any> runApplication(vararg args: String, init: SpringApp
*/
inline fun <reified T : Any> fromApplication(): SpringApplication.Augmented {
val type = T::class
val ktClassName = type.qualifiedName + "Kt"
val ktClassName = "${type.qualifiedName}Kt"
try {
val ktClass = ClassUtils.resolveClassName(ktClassName, type.java.classLoader)
val mainMethod = ReflectionUtils.findMethod(ktClass, "main", Array<String>::class.java)
Assert.notNull(mainMethod, "Unable to find main method")
return SpringApplication.from { ReflectionUtils.invokeMethod(mainMethod!!, null, it) }
} catch (ex: Exception) {
throw IllegalStateException("Unable to use 'fromApplication' with " + type.qualifiedName)
throw IllegalStateException("Unable to use 'fromApplication' with ${type.qualifiedName}")
}
}

Expand Down