inflearn logo

Real-world! Developing a library management application with Kotlin and Spring Boot (Refactoring a Java project)

We will refactor a web application built with Java + Spring Boot to Kotlin + Spring Boot and implement additional requirements. In the process, we will use Junit5, SQL, JPA, and Querydsl, and cover the pros and cons of various methods from the design and implementation perspectives.

(5.0) 156 reviews

2,281 learners

Level Basic

Course period Unlimited

Kotlin
Kotlin
Spring Boot
Spring Boot
Java
Java
Refactoring
Refactoring
Spring
Spring
Kotlin
Kotlin
Spring Boot
Spring Boot
Java
Java
Refactoring
Refactoring
Spring
Spring

News

1 articles

  • lannstark님의 프로필 이미지

    Hello! I have some additional considerations when using Kotlin and JPA together.

    The content is that you need to add the following script to build.gradle!

     

    plugins { id "org.jetbrains.kotlin.plugin.allopen" version "1.6.21" } // plugins, dependencies와 같은 Level (즉 build.gradle 최상단) allOpen { annotation("javax.persistence.Entity") annotation("javax.persistence.MappedSuperclass") annotation("javax.persistence.Embeddable") }

     

    Here's why!

    As you know, Kotlin basically makes both classes and functions final!! (That is, it prevents inheritance and overriding!)

    However, to fully utilize Proxy Lazy Fetching when using JPA (there's a talk about Lazy Fetching in Lesson 27!), the class must be inheritable!! From what I've checked, Lazy Fetching works for @OneToMany, but it doesn't work for @ManyToOne even if I explicitly give it the Lazy Fetching option.

     

    So, through the all-open feature, @Entity classes need to be processed so that the class remains open even when decompiled, and the script above performs that role.

    In this lecture, we do not use @ManyToOne Lazy Fetching, so the plugin was not mentioned in the lecture. From now on, I will design more carefully so that I do not miss more content. 🙇 I think it would be good to set up the plugin in the actual project!! Thank you!! 🙏

     

     

    (The same content was also uploaded to <Lecture 14. 3 Things to Talk About When Using Kotlin and JPA Together>!)

     

    0

$59.40