Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5기 - 홍지인] SpringBoot Part3 Weekly Mission 제출합니다. #963

Open
wants to merge 90 commits into
base: JIN-076/week3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
26ff77d
init: 프로그램 초기 설정 세팅
JIN-076 Oct 14, 2023
ace60ec
init: application.properties 삭제. build.gradle 필요한 의존성 추가. 자바 버전 17로 변경
JIN-076 Oct 18, 2023
549a095
update: Application 클래스 이름 변경
JIN-076 Oct 18, 2023
161141f
feature: Voucher 인터페이스, FixedAmountVoucher / PercentDiscountVoucher 구…
JIN-076 Oct 18, 2023
e55402f
feature: VoucherType Enum 구현, type에 맞는 VoucherType 반환 메서드 구현
JIN-076 Oct 18, 2023
b0f3a9a
feature: save, findAll 메서드를 갖는 VoucherRepository 인터페이스 추가
JIN-076 Oct 18, 2023
4a919e2
feature: service 레이어와 controller 레이어 간의 요청과 응답 전달을 위한 requestDto, res…
JIN-076 Oct 18, 2023
d30cf51
feature: 명령어와 VoucherType에 따른 생성 로직과 조회 로직을 Service 레이어에게 호출하는 Vouche…
JIN-076 Oct 18, 2023
c6c30fa
feature: voucher 관련 커스텀 예외 클래스 추가
JIN-076 Oct 18, 2023
aa6b869
feature: controller 레이어와 service 레이어 간 요청과 응답을 위한 직렬화, 역직렬화를 담당하는 Map…
JIN-076 Oct 18, 2023
c7a01a2
feature: voucher 저장 로직과 조회 로직을 갖는 인메모리 저장소의 VoucherRepository 구현체 추가,…
JIN-076 Oct 18, 2023
5e94739
feature: controller 요청을 처리하고 repository 레이어로 요청을 전달하는 Service 클래스 추가,…
JIN-076 Oct 18, 2023
cb9555f
feature: console 관련 로직을 담당하는 manager 클래스 추가
JIN-076 Oct 18, 2023
8a93031
feature: csv 파일 관련 로직을 담당하는 manager 추가
JIN-076 Oct 18, 2023
39005b0
feature: Voucher 관련한 객체 생성 팩토리 메서드 로직을 갖는 config 추가
JIN-076 Oct 18, 2023
a8fc358
feature: 고객 Customer 도메인 추가, 응답 전달을 위한 Dto 추가
JIN-076 Oct 18, 2023
b36e226
feature: 고객 타입을 규정하는 Enum 클래스 추가, 블랙리스트 조회 로직을 Service 레이어에게 전달하는 Con…
JIN-076 Oct 18, 2023
5545978
feature: csv 파일과 console 관련 커스텀 예외 클래스 추가
JIN-076 Oct 18, 2023
326a64f
feature: 명령어 타입을 규정하는 commandType Enum 클래스 추가, commandLineRunner를 이용한…
JIN-076 Oct 18, 2023
a5ced0d
feature: customer 도메인 관련 Service 클래스 추가
JIN-076 Oct 18, 2023
15a8d59
feature: Dto 이용을 위한 직렬화, 역직렬화를 담당하는 customer 도메인의 Mapper 클래스 추가
JIN-076 Oct 18, 2023
079c3b8
feature: Customer 도메인과 CommandType 관련 커스텀 예외 클래스 추가
JIN-076 Oct 18, 2023
0034a75
feature: Customer 도메인 객체 생성을 담당하는 Config 클래스 추가
JIN-076 Oct 18, 2023
ce5ab48
feature: 애플리케이션에서 사용되는 명시적인 의미의 상수들을 다루는 Constants 클래스 추가
JIN-076 Oct 18, 2023
dc49448
feature: customer 도메인을 저장소에 저장하고 조회하는 Repository 클래스 추가
JIN-076 Oct 18, 2023
82a06c5
feature: voucher 도메인을 파일에 저장하고 조회하는 Repository 클래스 추가
JIN-076 Oct 18, 2023
b461235
feature: yaml 정보를 바인딩하는 Properties 클래스 추가
JIN-076 Oct 18, 2023
35e8151
feature: 파일 관련 정보를 담고 있는 application.yaml 추가
JIN-076 Oct 18, 2023
8ae75a3
feature: customer 도메인과 voucher 도메인의 서비스 파일과 테스트 파일 추가
JIN-076 Oct 18, 2023
03b9506
feature: log 관련 정보를 담은 logback.xml 추가
JIN-076 Oct 18, 2023
714f720
feature: logback.xml name 수정
JIN-076 Oct 18, 2023
b38e324
feature: 'jar'에서 중복되는 / 제거
JIN-076 Oct 18, 2023
dbd9118
update: getFilePath의 fileName을 받아오는 get 메서드 인자 수정
JIN-076 Oct 18, 2023
d8fbddb
update: application.yaml 'jar' filePath에 '/' 추가
JIN-076 Oct 18, 2023
2ea82f0
update: 디버깅 위한 System.out.println() 제거
JIN-076 Oct 18, 2023
ce5be87
update: 사용되지 않는 Serializable 의존성 삭제
JIN-076 Oct 19, 2023
fe63dac
feature : FileVoucherRepository의 메서드에 대해 동시성 제어 성공 테스트 추가
JIN-076 Oct 19, 2023
038c6e3
update : .jar 실행 여부를 확인하는 isRunningFromJar 메서드를 AppConfig 클래스에 static…
JIN-076 Oct 19, 2023
04cad26
update : .jar 실행 여부를 확인하는 isRunningFromJar 메서드를 AppConfig 클래스에 static…
JIN-076 Oct 19, 2023
e85f430
Merge branch 'main' of https://github.com/JIN-076/springboot-basic
JIN-076 Oct 19, 2023
3583061
update : application.yaml에 @Profile('default') 활성화 추가
JIN-076 Oct 19, 2023
f86d4e4
update : FileVoucherRepository 테스트에서 TestVoucherService와 TestFileVouc…
JIN-076 Oct 19, 2023
4414530
update : .jar로 실행했을 때, arg로 path를 전달해 yaml에 종속되지 않도록 변경함
JIN-076 Oct 20, 2023
268873d
update : 패키징된 .jar로 실행했을 때, arg로 path를 전달해 yaml에 종속되지 않도록 변경함
JIN-076 Oct 20, 2023
6be15f7
update : application.yaml과 테스트 코드 상에서 .jar 실행에 대해 path를 얻어오는 내용 삭제
JIN-076 Oct 21, 2023
6b4903a
update: application.yaml에서 테스트를 위한 속성 제거
JIN-076 Oct 21, 2023
3001cfd
update : private 생성자를 추가해 불필요한 클래스 생성을 방지
JIN-076 Oct 21, 2023
e9e2d15
init: 프로젝트 초기 세팅
JIN-076 Nov 4, 2023
6b28f1e
feat: 데이터베이스 연결을 위한 DataSource, Profile active 설정
JIN-076 Nov 4, 2023
45e5dfd
feat: 현재 사용되지 않는 week1,2 메서드 세팅
JIN-076 Nov 4, 2023
20ebe21
feat: 의존성 추가
JIN-076 Nov 4, 2023
854a5ae
feat: 메인페이지 (home.html) 과 에러페이지 (error.html) 추가
JIN-076 Nov 4, 2023
a9cd31f
feat: voucher 관련 Html 추가
JIN-076 Nov 4, 2023
f516bdf
feat: wallet 관련 Html 추가
JIN-076 Nov 4, 2023
4446edb
feat: 기존 과제에 사용된 코드 삭제
JIN-076 Nov 4, 2023
4e39a1a
feat: 명시적인 의미를 담는 상수 클래스 추가
JIN-076 Nov 4, 2023
d17ec4a
feat: discount 타입을 검증하는 클래스 추가
JIN-076 Nov 4, 2023
7c655ae
feat: 커스텀 RuntimeException 클래스 추가
JIN-076 Nov 4, 2023
abcf986
feat: CustomerType 관련 ENUM 클래스 추가
JIN-076 Nov 4, 2023
78b5c81
feat: VoucherType 관련 ENUM 클래스 추가
JIN-076 Nov 4, 2023
1f28a80
feat: voucherType에 따른 validator 주입을 위해 스프링 빈으로 등록, 관리
JIN-076 Nov 4, 2023
b7c5571
feat: Dto 클래스에 기본 메서드, 출력 메서드 추가
JIN-076 Nov 4, 2023
a2a3473
feat: UUID 랜덤 생성을 위한 Generator 클래스 추가
JIN-076 Nov 4, 2023
3237166
feat: UUID와 byte[] 간의 변환을 담당하는 Converter 클래스 추가
JIN-076 Nov 4, 2023
e0eb63e
feat: Customer 도메인 클래스, TDA 적용을 위해 상태 변경의 set 메서드와 equal 메서드 추가
JIN-076 Nov 4, 2023
8516979
feat: Voucher 도메인 클래스, TDA 적용을 위해 Discount 검증 메서드와 MapStruct 적용을 위한 s…
JIN-076 Nov 4, 2023
b1780ba
feat: Email 검증을 위한 도메인 클래스 추가, 이메일의 유효성 검증 메서드 추가
JIN-076 Nov 4, 2023
f4a37d0
feat: LocalDateTime을 생성 시에 주입하기 위한 Generator 클래스 추가
JIN-076 Nov 4, 2023
60ef32c
feat: Wallet 도메인 클래스 추가
JIN-076 Nov 4, 2023
1251ce6
feat: Wallet 관련 Dto 클래스 추가
JIN-076 Nov 4, 2023
70a100c
feat: 중복 체크 메서드 추가, 조건별로 조회를 수행하는 find 메서드 추가 (null이 들어오면 조건 무시)
JIN-076 Nov 4, 2023
99c3e50
feat: Email 타입에 대한 매핑 관련 로직 추가
JIN-076 Nov 4, 2023
145ce53
feat: Wallet 관련 Repository 클래스 추가
JIN-076 Nov 4, 2023
31297c0
feat: AOP를 위한 Logger 기능을 하는 클래스 추가
JIN-076 Nov 4, 2023
8fed624
feat: Profile에 따른 빈 등록 메서드 ㅊ가
JIN-076 Nov 4, 2023
1bc56bf
feat: Profile에 따른 빈 등록 메서드 추가
JIN-076 Nov 4, 2023
7a1d2bc
feat: web에서 전달받은 데이터를 담아두는 Dto 클래스 ㅊ가
JIN-076 Nov 4, 2023
6369e89
Merge remote-tracking branch 'origin/JIN-076/week3' into JIN-076/week3
JIN-076 Nov 4, 2023
051959d
feat: 현재 active된 Profile에 따른 빈 등록 메서드 추가
JIN-076 Nov 4, 2023
78c3389
feat: Dto와 Entity간의 매핑을 담당하는 Mapper 클래스 추가
JIN-076 Nov 4, 2023
1d8a597
feat: 에러 발생 시에 반환할 ResponseEntity를 위한 ErrResponse, ErrCode 클래스 추가
JIN-076 Nov 4, 2023
30b4549
feat: 애플리케이션을 아우르는 Controller, 메인 페이지를 매핑하는 로직 추가
JIN-076 Nov 4, 2023
34ffcff
feat: 중복 체크를 위한 Duplicate 메서드, TDA를 적용한 Email 검증 메서드 추가
JIN-076 Nov 4, 2023
0856fd6
feat: 중복 체크를 위한 Duplicate 메서드, TDA를 적용한 Discount 유효범위 검증 메서드 추가
JIN-076 Nov 4, 2023
7072f49
feat: Wallet 관련 서비스 로직 추가, TDA를 적용한 Email 유효범위 검증 메서드 추가
JIN-076 Nov 4, 2023
818a941
feat: Voucher, Wallet 관련 페이지 매핑을 위한 WebController ㅊ가
JIN-076 Nov 4, 2023
45d1d84
feat: Voucher, Wallet 관련 페이지 매핑을 위한 WebController 추가
JIN-076 Nov 4, 2023
ebcf698
feat: Voucher 서비스에 대한 REST API 개발
JIN-076 Nov 4, 2023
3efc2b6
Merge remote-tracking branch 'origin/JIN-076/week3' into JIN-076/week3
JIN-076 Nov 4, 2023
47fd1bf
feat: 예외에 대해서 한 번에 처리하는 RestControllerAdvice를 적용한 ExceptionHandler 클래…
JIN-076 Nov 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

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

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
36 changes: 36 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
}

group = 'org.programmers'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradle 문법에서 dependencies라는 의존성을 추가하는 문법의 속성에는 어떤 것들이 있고, 어떤 역할들을 하는지 알고 계신지요?

implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'com.mysql:mysql-connector-j:8.0.32'
implementation 'org.projectlombok:lombok'
implementation 'org.mapstruct:mapstruct:1.4.2.Final'
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'org.assertj:assertj-core:3.24.2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
249 changes: 249 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done

# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

warn () {
echo "$*"
} >&2

die () {
echo
echo "$*"
echo
exit 1
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"