: 기존 build.gradle 파일 변경
plugins {
id 'org.springframework.boot' version '2.7.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor //lombok
}
}
repositories {
mavenCentral() //mavenCentral에서 라이브러리 다운 받겠다는것
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'mysql:mysql-connector-java'
implementation 'org.projectlombok:lombok:1.18.12'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
test {
useJUnitPlatform()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'mysql:mysql-connector-java'
implementation 'org.projectlombok:lombok:1.18.12'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6'
implementation 'com.google.code.gson:gson:2.8.5'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
implementation 'javax.xml.bind:jsxb-api'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
// TEST
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'io.rest-assured:rest-assured:3.3.0'
// 빌드
//implementation 'org.glassfish.jaxb:jaxb-runtime'
}
: 🚩logging 추가해야함
spring:
datasource:
url: jdbc:mysql://localhost:3306/Lotto?
username: root
password: 232323
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
# show_sql: true
format_sql: true
logging:
level:
org.hibernate.sql: debug
# org.hibernate.type: trace 파라미터에 뭐가 들어가는지 찍어줌
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 로그파일 저장 경로 -->
<!-- CONSOLE -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} : %30logger{5} - %msg%n
</Pattern>
</layout>
</appender>
<!-- // CONSOLE -->
<root level="warn">
<appender-ref ref="CONSOLE" />
</root>
<!--//구간 설정-->
<logger name="lotto.practice.random.service" level="debug" additivity="false">
<appender-ref ref="CONSOLE" />
</logger>
</configuration>
: 예제는 편의를 위해서 jpa-ddl-auto를 create로 사용하였습니다
: String 길이 설정하기
@Table(name = "t_user",
uniqueConstraints = @UniqueConstraint(
name = "unique",
columnNames = {"f_user_id","f_user_pw", "f_user_email"}
))
https://kafcamus.tistory.com/15
https://www.wake-up-neo.com/ko/java/url%EC%97%90%EC%84%9C-json-%ED%8C%8C%EC%8B%B1/940071612/