문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
kotlin:kotlin_spring [2021/05/12 14:38] kwon37xi |
kotlin:kotlin_spring [2022/10/04 17:12] (현재) kwon37xi |
||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| - | ====== Kotlin with SpringFramework ====== | + | ====== Kotlin with SpringFramework |
| * [[: | * [[: | ||
| + | * [[java: | ||
| + | |||
| + | ===== all-open / kotling-spring compiler plugin ===== | ||
| + | * https:// | ||
| + | * Spring 의 경우 '' | ||
| + | * Kotlin 이 기본 '' | ||
| + | * [[: | ||
| + | |||
| + | ===== no-arg / kotlin-jpa plugin ===== | ||
| + | * JPA Entity나, 일부 프레임워크는 기본 생성자를 필수적으로 필요로 한다. | ||
| + | * [[https:// | ||
| + | * '' | ||
| + | |||
| + | ===== JPA 지연 로딩에 대해서 강제로 all open 지정 필요 ===== | ||
| + | * JPA lazy loading 을 하려면 Entity가 '' | ||
| + | |||
| + | <code kotlin> | ||
| + | // gradle | ||
| + | plugins { | ||
| + | kotlin(" | ||
| + | kotlin(" | ||
| + | } | ||
| + | allOpen { | ||
| + | annotation(" | ||
| + | annotation(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== QueryDSL ===== | ||
| + | * [[https:// | ||
| + | |||
| + | ===== @Transient 는 getter 사용 ===== | ||
| + | * JPA '' | ||
| + | |||
| + | <code kotlin> | ||
| + | // @Transient 불필요. | ||
| + | val fixed: Boolean | ||
| + | get() = startDate.until(endDate).years < 1 | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Field 초기화는 lateinit ===== | ||
| + | * 필드 포기화가 필요할 경우에는 '' | ||
| + | * '' | ||
| + | <code kotlin> | ||
| + | @Autowired | ||
| + | private lateinit var objectMapper: | ||
| + | </ | ||
| + | '' | ||
| + | |||
| + | ===== Jackson ===== | ||
| + | * [[java: | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ===== @ConfigurationProperties / @ConstructorBinding ===== | ||
| + | * Immutable data class 에 대해 [[springframework: | ||
| + | |||
| + | <code kotlin> | ||
| + | @ConfigurationProperties(" | ||
| + | @ConstructorBinding | ||
| + | data class MyProperties(val url: String) | ||
| + | </ | ||
| + | |||
| + | ===== 참조 ===== | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| 줄 6: | 줄 72: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||