본문 바로가기
서버/Kotlin-Spring_Boot

코틀린 should have [public, protected] no-arg constructor

by HDobby 2023. 5. 29.

코틀린 should have [public, protected] no-arg constructor 에러

 

ManyToOne을 사용하는데 또 다시 나오는 no-arg constructor 때문에 해결법을 찾게 되었다.

 

build.gradle.kt에 아래 구문을 추가 해주면 된다.

 

plugins {
	id("org.jetbrains.kotlin.plugin.noarg") version "1.7.22"
}

noArg {
	annotation("jakarta.persistence.Entity")
}

플러그인의 버전은 코틀린의 버전을 적으면 된다고 한다.

 

https://kotlinlang.org/docs/no-arg-plugin.html

 

No-arg compiler plugin | Kotlin

 

kotlinlang.org

 

728x90

댓글