From 24fba1d0682c97f4e05a8eda85b901df3e8067ba Mon Sep 17 00:00:00 2001 From: jeonghyeon00 Date: Mon, 21 Oct 2024 13:06:00 +0900 Subject: [PATCH] refactor: use kotlin's string templates for better readability and maintainability --- .../org/springframework/boot/SpringApplicationExtensions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/kotlin/org/springframework/boot/SpringApplicationExtensions.kt b/spring-boot-project/spring-boot/src/main/kotlin/org/springframework/boot/SpringApplicationExtensions.kt index 142838bfd416..40ae79f3c3cd 100644 --- a/spring-boot-project/spring-boot/src/main/kotlin/org/springframework/boot/SpringApplicationExtensions.kt +++ b/spring-boot-project/spring-boot/src/main/kotlin/org/springframework/boot/SpringApplicationExtensions.kt @@ -55,14 +55,14 @@ inline fun runApplication(vararg args: String, init: SpringApp */ inline fun 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::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}") } }