Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ihoneymon/861d996bac1b2f1a84359ed75cef2fdb to your computer and use it in GitHub Desktop.
Save ihoneymon/861d996bac1b2f1a84359ed75cef2fdb to your computer and use it in GitHub Desktop.
스프링 부트 애플리케이션을 코틀린으로 구현하기 위해 필요한 라이브러리 kotlin-reflection

20190415 'Kotlin reflection implementation not found at runtime'

코틀린으로 간단한 스프링 부트 애플리케이션을 만들어 실행하는데 눈에 걸리는 로그가 있었다.

> Task :bootiful-sbadmin:bootRun
11:07:07.591 [main] INFO org.springframework.core.KotlinDetector - Kotlin reflection implementation not found at runtime, related features won't be available.

실행시 코틀린 리플렉션 관련한 구현체가 없어서 해당기능을 사용할 수 없다는 메시지였다. @_@)?

관련된 의존성 라이브러리 선언을 보면 다음과 같다.

dependencies {
    compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    compile("org.jetbrains.kotlin:kotlin-reflect")
    /**
     * @see <a href="https://kotlinlang.org/docs/reference/kapt.html">Annotation Processing with Kotlin</a>
     */
    kapt("org.springframework.boot:spring-boot-configuration-processor")
    compileOnly("org.springframework.boot:spring-boot-configuration-processor")

    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("org.jetbrains.kotlin:kotlin-test-junit")
    testCompile("org.jetbrains.kotlin:kotlin-test")
}

그래서 관련내용을 찾아봤다.

답은 간단하다. ㅡ_-);;

kotlin-reflection 라이브러리만 추가하면 된다.

dependencies {
   /**
    * Spring Boot 가 Kotlin 을 지원하기 위해서 필요한 2가지
    * @see <a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-kotlin">Kotlin Support</a>
    */
   compile("org.jetbrains.kotlin:kotlin-stdlib")
   compile("org.jetbrains.kotlin:kotlin-reflect")

   /**
    * @see <a href="https://kotlinlang.org/docs/reference/kapt.html">Annotation Processing with Kotlin</a>
    */
   kapt("org.springframework.boot:spring-boot-configuration-processor")
   compileOnly("org.springframework.boot:spring-boot-configuration-processor")

   testCompile("org.jetbrains.kotlin:kotlin-test")
   testCompile("org.springframework.boot:spring-boot-starter-test")
   testCompile("org.jetbrains.kotlin:kotlin-test-junit")
}

스프링 부트를 코틀린으로 구현하고 실행하기 위해서 공부해야할 게 많다. 많아.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment