Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
프로젝트 설정 (#4)
Browse files Browse the repository at this point in the history
* [#1]프로젝트 생성

-의존성 추가
-h2 DB 초기 설정

* .gitignore 추가

* [#1]프로젝트 설정

-패키지명 변경
-profile 구분

* etc : application.yml 설정 추가 및 주석 추가

1. profile 별로 ddl-auto 속성 설정
2. 각 설정에 대한 주석 추가

[#1] 프로젝트 설정

* etc: applicaition.yml 수정

-오타 수정
-주석 수정

[#1] 프로젝트 설정

* [#1] application.yml 분리

* [#1]chore: yml 분리

- 모든 profile에서 사용되는 전역설정 분리

* [#1]chore: 리뷰 반영

-logging 옵션 분리 적용
-production profile 용 yml 생성

* [#1]chore: properties 설정 불필요한 값 제거
  • Loading branch information
Hosick authored Jan 19, 2021
1 parent 9640cb1 commit d73885e
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
HELP.md
.gradle
gradle/
gradlew
gradlew.bat
build/
!gradle/wrapper/gradle-wrapper.jar


### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/


48 changes: 48 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'org.asciidoctor.convert' version '1.5.8'
id 'java'
}

group = 'com.flab'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

ext {
set('snippetsDir', file("build/generated-snippets"))
}

dependencies {
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.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'

// springboot 2.3 버전부터 Valid 가 Web-starter 에서 제외됨으로 추가
implementation 'org.springframework.boot:spring-boot-starter-validation'
}

test {
outputs.dir snippetsDir
useJUnitPlatform()
}

asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'shoeauction'
12 changes: 12 additions & 0 deletions src/main/java/com/flab/shoeauction/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.flab.shoeauction;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
12 changes: 12 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# dev profile에 적용되는 properties
# org.hibernate.SQL : 로거를 이용한 쿼리문 출력
# org.hibernate.type : ?로 표시된 쿼리 파라미터 값을 로그로 출력
# ddl-auto (validate) : 엔티티와 테이블이 정상적으로 매핑되었는지만 확인한다. (테스트단계와 스테이징 서버에서 사용)
spring:
jpa:
hibernate:
ddl-auto: validate

logging.level:
org.hibernate.SQL: debug
org.hibernate.type: trace
17 changes: 17 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# local profile에 적용되는 properties
# org.hibernate.SQL : 로거를 이용한 쿼리문 출력
# org.hibernate.type : ?로 표시된 쿼리 파라미터 값을 로그로 출력
# ddl-auto (create) : 개발 초기 환경에서 사용. 애플리케이션 로딩 시점에 모든 테이블을 drop 후 새로 생성, 애플리케이션 서버 종료 후에도 DB 보존 (개발 초기단계에 사용)
spring:
datasource:
url: jdbc:h2:tcp://localhost/~/shoeactions
username: sa
password:
driver-class-name: org.h2.Driver
jpa:
hibernate:
ddl-auto: create

logging.level:
org.hibernate.SQL: debug
org.hibernate.type: trace
2 changes: 2 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# prod profile에 적용되는 properties
# 운영 서버에서는 ddl-auto 옵션을 사용하지 않는다.
7 changes: 7 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# profile을 타지않는 전역 설정
# format_sql : query의 출력 내용을 서식에 맞게 가독성을 향상시켜 출
spring:
jpa:
properties:
hibernate:
format_sql: true
13 changes: 13 additions & 0 deletions src/test/java/com/flab/shoeauction/ApplicationTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.flab.shoeauction;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class ApplicationTests {

@Test
void contextLoads() {
}

}

0 comments on commit d73885e

Please sign in to comment.