1. 톰캣 수동 배포
<Context path="/" docBase="war파일이름" reloadable="false" > </Context>
//
2. Ngrok
//
3. Todo 앱 만들기
//
4. 기타
//
5. JMT 주문시스템 & 게시판 만들기
docker run -p 5432:5432 -e
POSTGRES_PASSWORD=비밀번호 -e POSTGRES_USER=아이디 -e
POSTGRES_DB=springboot --name postgres_boot -d postgres
build.gradle의 dependency 중.
runtimeOnly 'org.postgresql:postgresql' // 런타임 때 사용하는 디비
.yml 중.
spring:
datasource: #도커에서 실행하는 DB
url: jdbc:postgresql://localhost:5432/springboot
password: 1234
username: test
[build.gradle]
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.8'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id "org.asciidoctor.jvm.convert" version "3.3.2" // .adoc 파일 생성을 위한 플러그인
}
ext {
set('snippetsDir', file("build/generated-snippets"))
// snippetsDir : 테스트 실행시 생성되는 응답을 저장할 디렉토리 지정
}
group = 'CoffeeOrderWebApp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExtensions
// asciidoctorExtensions : Asciidoctor의 확장 기능을 사용하기 위한 설정
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
implementation 'com.google.code.gson:gson:2.9.0'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
// testImplementation("org.junit.vintage:junit-vintage-engine") {
// exclude group: "org.hamcrest", module: "hamcrest-core"
// }
}
tasks.named('test') {
outputs.dir snippetsDir // test 할 때 snippetsDir에 생성된 응답을 asciidoctor로 변환하여 .adoc 파일 생성
useJUnitPlatform()
}
// (7) asciidoctor를 사용하기 위해서 asciidoctor task에 asciidoctorExtensions 설정
tasks.named('asciidoctor') {
configurations "asciidoctorExtensions"
inputs.dir snippetsDir
dependsOn test
}
// (8) asciidoctor task 실행시 생성된 html 파일을 src/main/resources/static/docs 디렉토리에 카피
task copyDocument(type: Copy) {
dependsOn asciidoctor // (8-1)
from ("${asciidoctor.outputDir}/html5") // (8-2)
into ("src/main/resources/static/docs") // (8-3)
}
build {
dependsOn copyDocument // (9) 빌드되기전 copyDocument task 실행
}
bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}") { // (10-2) bootJar에 asciidoctor task에서 생성된 html 파일 추가
into 'static/docs' // (10-3) bootJar에 추가될 경로
}
}
[application.yml]
spring:
h2:
console:
enabled: true
path: /h2
datasource:
url: jdbc:h2:mem:test
jpa:
properties:
hibernate:
highlight_sql: true
format_sql: true # SQL pretty print
hibernate:
ddl-auto: create # 테이블 자동 구성(드랍 & 생성)
show-sql: true # SQL 보기
sql:
init:
data-locations: classpath*:db/h2/data.sql
output:
ansi:
enabled: always # debug, trace
logging:
level:
org:
hibernate:
type:
descriptor:
sql: TRACE # hibernate
springframework:
orm:
jpa: DEBUG