Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- sqld자격증합격
- 항해99후기
- java알고리즘문제풀이
- 코딩부트캠프후기
- java최솟값구하기
- java 자료구조 활용
- 프로그래머스
- 격파르타합격후기
- java set 저장
- 인터프린터언어
- java알고리즘
- java map 출력
- 격파르타장점
- 항해15기
- java map 저장
- java기본자료형
- java list 저장
- 격파르타비전공자
- java set 출력
- javaJVM
- java참조자료형
- java list 출력
- java map
- 작은수제거하기
- javaJRE
- 비전공자sqld
- 컴파일
- 격파르타후기
- 프로그래머스제일작은수
- 노베이스부트캠프
Archives
- Today
- Total
코딩과 결혼합니다
[Kotlin] 프로젝트 생성과 환경설정 본문
728x90
gradle.kts
//...
plugins {
id("org.springframework.boot") version "3.2.2"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
kotlin("plugin.jpa") version "1.9.22"
}
//...
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
developmentOnly("org.springframework.boot:spring-boot-devtools")
runtimeOnly("com.mysql:mysql-connector-j")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
allOpen {
annotation("jakarta.persistence.Entity")
}
noArg {
annotation("jakarta.persistence.Entity")
}
//...
🤔 All Open은 plug.spring에서 오픈해준 것 외에 추가로 오픈해줄 것을 명시
👓 No Alg는 매개변수가 없는 생성자들을 자동으로 추가해줄 때 명시
JPA를 쓸 때 엔티티에 이 두가지를 적용시키기 위해 선언을 해주었다.
버전을 변수에 담아 일괄 적용하는 방법도 있다.
plugins {
val kotlinVersion = "1.9.22"
id("org.springframework.boot") version "3.2.2"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion
}
yml 설정
- 이전에는 application.properties만 쓰다가 yml로 처음 설정해보았다.
server:
port: 8080
servlet:
context-path: /
encoding:
charset: UTF-8
enabled: true
force: true //request와 response에 인코딩을 강제
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/study
username: root
password:
jpa:
open-in-view: true //영속성 컨텍스트가 트랜잭션 범위를 넘어서 레이어까지 유지
hibernate:
ddl-auto: create
properties:
hibernate:
show_sql: false //로그에 SQL을 찍는 것을 설정했기 때문
format_sql: true
highlight_sql: true
logging:
pattern:
console: "[%d{HH:mm:ss.SSS}][%-5level][%logger.%method:line%line] - %msg%n"
level:
org:
hibernate:
SQL: debug
type.descriptor.sql: trace
jwt:
secret: DadFufN4Oui8Bfv3ScFj6R9fyJ9hD45E6AGFsXgFsRhT4YSdSb
'2세 > Spring' 카테고리의 다른 글
스프링 입문 : 정적 컨텐츠, MVC, API (0) | 2024.02.04 |
---|---|
스프링 입문 : 라이브러리 살펴보기 (0) | 2024.02.03 |
[Kotlin] 개념과 기초 문법 (0) | 2024.01.20 |
230816 - Controller에서 JPA Entity를 반환하면 안되는 이유 (0) | 2023.08.17 |
230727 - @Transactional 을 사용하는 이유 (0) | 2023.07.27 |