Skip to content

Commit 708e6f0

Browse files
authored
Merge pull request #1 from SeokRae/feat/settings_multi_module
feat: JPA Lock에 대한 학습을 위해 멀티 모듈 세팅
2 parents cdd6056 + c4e63a6 commit 708e6f0

File tree

7 files changed

+116
-45
lines changed

7 files changed

+116
-45
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JPA Lock 테스트 프로젝트
2+
3+
## Intro
4+
5+
- JPA Lock에 대한 학습 내용을 정리
6+
7+
## Settings
8+
9+
- 멀티 모듈기반으로 주제 별로 관리

build.gradle

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,71 @@
1-
plugins {
2-
id 'org.springframework.boot' version '2.5.6'
3-
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4-
id 'java'
1+
buildscript {
2+
ext {
3+
springBootVersion = '2.5.6'
4+
}
5+
repositories {
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10+
classpath "io.spring.gradle:dependency-management-plugin:1.0.10.RELEASE"
11+
}
12+
}
13+
14+
allprojects {
15+
group = 'com.example'
16+
version = '0.0.1-SNAPSHOT'
517
}
618

7-
group = 'com.example'
8-
version = '0.0.1-SNAPSHOT'
9-
sourceCompatibility = '11'
19+
subprojects {
20+
apply plugin: 'java'
21+
apply plugin: 'org.springframework.boot'
22+
apply plugin: 'io.spring.dependency-management'
1023

11-
configurations {
12-
compileOnly {
13-
extendsFrom annotationProcessor
24+
sourceCompatibility = JavaVersion.VERSION_11
25+
26+
configurations {
27+
compileOnly {
28+
extendsFrom annotationProcessor
29+
}
1430
}
15-
}
1631

17-
repositories {
18-
mavenCentral()
19-
}
32+
repositories {
33+
mavenCentral()
34+
}
2035

21-
dependencies {
22-
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
23-
implementation 'org.springframework.boot:spring-boot-starter-validation'
24-
implementation 'org.springframework.boot:spring-boot-starter-web'
25-
compileOnly 'org.projectlombok:lombok'
26-
developmentOnly 'org.springframework.boot:spring-boot-devtools'
27-
runtimeOnly 'com.h2database:h2'
28-
annotationProcessor 'org.projectlombok:lombok'
29-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
30-
}
36+
dependencies {
37+
compileOnly 'org.projectlombok:lombok'
38+
annotationProcessor 'org.projectlombok:lombok'
39+
}
40+
41+
test {
42+
useJUnitPlatform()
43+
}
44+
45+
// 해당 task로 서브 모듈 추가시 기초적인 디렉토리를 자동으로 생성해줍니다.
46+
task initSourceFolders {
47+
sourceSets*.java.srcDirs*.each {
48+
if (!it.exists()) {
49+
it.mkdirs()
50+
}
51+
}
3152

32-
test {
33-
useJUnitPlatform()
53+
sourceSets*.resources.srcDirs*.each {
54+
if (!it.exists()) {
55+
it.mkdirs()
56+
}
57+
}
58+
}
3459
}
60+
61+
62+
project(":optimistic") {
63+
dependencies {
64+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
65+
implementation 'org.springframework.boot:spring-boot-starter-validation'
66+
implementation 'org.springframework.boot:spring-boot-starter-web'
67+
developmentOnly 'org.springframework.boot:spring-boot-devtools'
68+
runtimeOnly 'com.h2database:h2'
69+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
package com.example.springjpalock;
1+
package com.example.optimistic;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55

66
@SpringBootApplication
7-
public class SpringJpaLockApplication {
8-
7+
public class OptimisticApplication {
98
public static void main(String[] args) {
10-
SpringApplication.run(SpringJpaLockApplication.class, args);
9+
SpringApplication.run(OptimisticApplication.class, args);
1110
}
12-
1311
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
server:
2+
port: 8090
3+
4+
spring:
5+
profiles:
6+
active: local
7+
8+
application:
9+
name: optimistic-jpa-service
10+
11+
# JPA 설정
12+
jpa:
13+
open-in-view: false
14+
hibernate:
15+
ddl-auto: none
16+
naming:
17+
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
18+
19+
# H2 설정
20+
h2:
21+
console:
22+
settings:
23+
web-allow-others: true
24+
path: /h2-console
25+
26+
# Datasource 설정
27+
datasource:
28+
driver-class-name: org.h2.Driver
29+
url: jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
30+
username: sa
31+
password:
32+
33+
logging:
34+
level:
35+
org:
36+
hibernate:
37+
sql: debug
38+
type: trace
39+

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
rootProject.name = 'spring-jpa-lock'
2+
include 'optimistic'
3+

src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/test/java/com/example/springjpalock/SpringJpaLockApplicationTests.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)