checkIn 프로젝트(SpringBoot)
팀 프로젝트 기본세팅
hazy1993
2022. 11. 3. 15:15
JAVA17
IntelliJ
Gradle
Thymeleaf
JPA
javaScript
jQuery
BootStrap
bulid.gradle
plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
}
group = 'com.teamProject.checkIn'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
//thymeleaf
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-devtools' //추가해주면 서버 재시작하지않아도 html 변경됨(리컴파일은 해줘야함)
}
tasks.named('test') {
useJUnitPlatform()
}
resource
>> application.properties
포트충돌때문에 8080 - > 8082 로 설징 및 thymeleaf 설정
server.port=8082
spring.thymeleaf.cache=false
spring.thymeleaf.chek-template-location=ture
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
>>applicaton.yml
DB관련 설정 및 로그 설정
debug: false #디버그를 할거냐? 각종 로그백들을 볼 수 있는데 너무 많아서 false 체크하고 원하는 애들만 설정할거임
management.endpoints.web.exposure.include: "*"
logging:
level: # 구체적으로 로그 레벨들을 여기서 명시
com.example.demo1: debug #여기 애들을 디버그 레벨을 띄움
org.springframework.web.servlet: debug # springframework.web 애들 디버그
org.hibernate.type.descriptor.sql.BasicBinder: trace # jpa 사용할 때, 쿼리 로그를 디버그 로그로 사용가능
spring:
datasource: # 데이터 베이스 접근
url: jdbc:mysql://localhost:3306/checkIn
username: root
password: 1234
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
open-in-view: false
defer-datasource-initialization: true # 테스트용 데이터 베이스 데이터를 만들 수 있게 하기 위해 resource안에 쿼리를 짜서 넣을때
hibernate.ddl-auto: create # 자동으로 ddl 문 작성 (create, update 등등 )
show-sql: true
properties: #하이버네이트 관련 설정
hibernate.format_sql: true # 쿼리문을 예쁘게 format
hibernate.default_batch_fetch_size: 100 # ex) n+1 쿼리 문제 대응
sql.init.mode: always