kotlin/boot/jpaの設定
2073 ワード
Spring Initializerでのアイテムの設定
build.gradle.ktsの変更

kotlin("kapt") version "1.3.72"
idea

idea {
module {
val kaptMain = file("target/kotlin")
sourceDirs.add(kaptMain)
generatedSourceDirs.add(kaptMain)
}
}
application.ymlの設定

server:
port: 9090
spring:
datasource:
url: jdbc:mysql://localhost:3306/locker_v1_dev?characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Seoul&useUnicode=true
username: root
password:
driver-class-name: org.mariadb.jdbc.Driver
## 운영 접속시 다시 한번 생각하기
jpa:
show-sql: true
# generate-ddl: true
hibernate:
# ddl-auto: create
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
entitymanager構成の設定

@Configuration
class QuerydslConfiguration (
@PersistenceContext private val entityManager: EntityManager){
@Bean
fun jpaQueryFactory(): JPAQueryFactory{
return JPAQueryFactory(entityManager)
}
}
repo、con、service、entity、モデルの追加
allow cross origin

format sqlの追加

jpa.properties.hibernate.format_sql:true

きれいだね
init
Reference
この問題について(kotlin/boot/jpaの設定), 我々は、より多くの情報をここで見つけました https://velog.io/@eueueu/kotlin-boot-jpa-세팅해보기テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol