├── .gitignore
├── .prettierrc
├── README.md
├── build.gradle.kts
├── docker
├── docker-compose-jenkins.yml
├── docker-compose-mariadb.yml
├── docker-compose-redis.yml
├── master_db
│ └── config
│ │ └── my.cnf
└── slave_db
│ └── config
│ └── my.cnf
├── document
└── Swagger Annotations Changes
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── http
├── http-client.env.json
└── reactive
│ └── MethodArgumentExample.http
├── mvc
├── build.gradle.kts
└── src
│ ├── main
│ ├── java
│ │ └── studio
│ │ │ └── thinkground
│ │ │ └── aroundhub
│ │ │ └── mvc
│ │ │ ├── Application.java
│ │ │ ├── common
│ │ │ ├── CommonResponse.java
│ │ │ ├── Constants.java
│ │ │ ├── annotation
│ │ │ │ ├── FieldAnnotation.java
│ │ │ │ ├── MethodAnnotation.java
│ │ │ │ ├── TypeAnnotation.java
│ │ │ │ └── ValidationAnnotation.java
│ │ │ ├── exception
│ │ │ │ ├── AroundHubException.java
│ │ │ │ └── AroundHubExceptionHandler.java
│ │ │ └── valid
│ │ │ │ ├── ParameterValidator.java
│ │ │ │ └── TempDto.java
│ │ │ ├── config
│ │ │ ├── JasyptConfig.java
│ │ │ ├── JpaAuditingConfiguration.java
│ │ │ ├── OpenAPIConfiguration.java
│ │ │ ├── ProfileManager.java
│ │ │ ├── WebMvcConfig.java
│ │ │ └── cache
│ │ │ │ ├── CacheConfig.java
│ │ │ │ └── RedisCacheConfig.java
│ │ │ ├── controller
│ │ │ ├── ConditionController.java
│ │ │ ├── DeleteController.java
│ │ │ ├── GetController.java
│ │ │ ├── HelloController.java
│ │ │ ├── ListenerController.java
│ │ │ ├── PostController.java
│ │ │ ├── ProductController.java
│ │ │ ├── PutController.java
│ │ │ ├── RestTemplateController.java
│ │ │ └── ShortUrlController.java
│ │ │ ├── data
│ │ │ ├── dao
│ │ │ │ ├── ProductDAO.java
│ │ │ │ ├── ShortUrlDAO.java
│ │ │ │ └── impl
│ │ │ │ │ ├── ProductDAOImpl.java
│ │ │ │ │ └── ShortUrlDaoImpl.java
│ │ │ ├── dto
│ │ │ │ ├── MemberDTO.java
│ │ │ │ ├── NaverUriDto.java
│ │ │ │ ├── ProductDto.java
│ │ │ │ └── ShortUrlResponseDto.java
│ │ │ ├── entity
│ │ │ │ ├── BaseEntity.java
│ │ │ │ ├── Listener.java
│ │ │ │ ├── Product.java
│ │ │ │ ├── ShortUrl.java
│ │ │ │ └── listener
│ │ │ │ │ └── CustomListener.java
│ │ │ ├── handler
│ │ │ │ ├── ProductDataHandler.java
│ │ │ │ └── impl
│ │ │ │ │ └── ProductDataHandlerImpl.java
│ │ │ └── repository
│ │ │ │ ├── ListenerRepository.java
│ │ │ │ ├── ProductRepository.java
│ │ │ │ ├── ShortUrlRedisRepository.java
│ │ │ │ └── ShortUrlRepository.java
│ │ │ ├── interceptor
│ │ │ └── HttpInterceptor.java
│ │ │ ├── service
│ │ │ ├── ListenerService.java
│ │ │ ├── ProductService.java
│ │ │ ├── RestClientService.java
│ │ │ ├── RestTemplateService.java
│ │ │ ├── ShortUrlService.java
│ │ │ └── impl
│ │ │ │ ├── ListenerServiceImpl.java
│ │ │ │ ├── ProductServiceImpl.java
│ │ │ │ ├── RestClientServiceImpl.java
│ │ │ │ ├── RestTemplateServiceImpl.java
│ │ │ │ └── ShortUrlServiceImpl.java
│ │ │ └── util
│ │ │ ├── KakaoPortalApi.java
│ │ │ ├── NaverPortalApi.java
│ │ │ ├── PortalApi.java
│ │ │ └── PortalApiConfig.java
│ └── resources
│ │ ├── application.yml
│ │ └── logback-spring.xml
│ └── test
│ └── java
│ └── studio
│ └── thinkground
│ └── aroundhub
│ └── mvc
│ ├── ApplicationTests.java
│ ├── config
│ └── JasyptTest.java
│ ├── controller
│ └── ProductControllerTest.java
│ ├── impl
│ └── ProductServiceImplTest.java
│ ├── repository
│ ├── DevProductRepositoryTest.java
│ ├── LocalProductRepositoryTest.java
│ └── ProductRepositoryTest.java
│ └── test
│ └── TestLifeCycle.java
├── reactive
├── build.gradle.kts
└── src
│ └── main
│ ├── java
│ └── studio
│ │ └── thinkground
│ │ └── reactive
│ │ ├── Application.java
│ │ ├── basic
│ │ ├── BasicController.java
│ │ ├── BasicRouter.java
│ │ └── MethodArgumentExample.java
│ │ ├── common
│ │ └── config
│ │ │ └── ApplicationConfig.java
│ │ └── user
│ │ ├── User.java
│ │ ├── UserHandler.java
│ │ ├── UserRouterConfig.java
│ │ └── UserService.java
│ └── resources
│ ├── application.yml
│ └── logback-spring.xml
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### docker ###
23 | !**/docker/
24 | **/docker/master_db
25 | **/docker/slave_db
26 |
27 | ### NetBeans ###
28 | /nbproject/private/
29 | /nbbuild/
30 | /dist/
31 | /nbdist/
32 | /.nb-gradle/
33 | build/
34 | !**/src/main/**/build/
35 | !**/src/test/**/build/
36 |
37 | ### VS Code ###
38 | .vscode/
39 |
40 | .gradle
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | useTabs: false
2 | tabWidth: 2
3 | endOfLine: lf
4 | semi: true
5 | trailingComma: es5
6 | singleQuote: true
7 | printWidth: 120
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 | ## Around Hub Studio 'Spring Boot'
5 |
6 |
유튜브(YouTube)에서 스프링 부트 강의를 진행하면서 사용한 예제 코드를 공유하고 있습니다.
7 | 핵심 코드만 공유하는 것이 아니라 '실행 가능한' 형태로 공유하고 있어 그대로 사용하실 수 있습니다.
8 | 도움이 되셨으면 좋겠습니다 :)
9 |
10 |
11 |
12 | ### Contents
13 |
14 | 스프링 부트 강의 영상에 맞춰 매번 코드가 변경될 수 있습니다.
15 | 최대한 변경된 내용을 커밋 코멘트에 남기지만 넓은 범위로 변경될 경우 일치하지 않을 수 있습니다.
16 |
17 |
18 | #### Docker 사용법
19 | 1. ./docker 경로에 있는 docker-compose-*.yml 파일을 관리에 용이한 디렉토리에 복사합니다.
20 | 2. 아래와 같이 실행합니다.
21 |
22 |
23 | ## 파일마다 아래와 같은 커맨드로 실행합니다.
24 | docker-compose -f {파일명}.yml up -d
25 |
26 |
27 |
28 | ### Around Hub Studio & ThinkGround
29 |
30 | I'm Flature
31 | Around Hub Studio 와 ThinkGround 는 제가 운영하는 포트폴리오 사이트와 유튜브 채널입니다.
32 | 어라운드 허브 스튜디오는 IT 기술 정보를 공유하는 채널입니다.
33 | 대부분의 소스코드는 ThinkGround 와 Around Hub Studio가 소유하고 있습니다.
34 |
35 |
36 |
37 |
38 |
39 | YouTube
40 |
41 |
42 |
43 |
44 | Major Skill Stack
45 |
46 |
47 |
48 |
49 |
50 |
51 | Minor Skill Stack
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | java
3 | id("org.springframework.boot") version "3.2.4"
4 | id("io.spring.dependency-management") version "1.1.0"
5 | id("io.freefair.lombok") version "6.6.1"
6 | id("com.diffplug.spotless") version "6.25.0"
7 | }
8 |
9 | group = "studio.thinkground"
10 | version = "1.0.0"
11 | description = "around-hub-spring-boot"
12 | java.sourceCompatibility = JavaVersion.VERSION_17
13 |
14 | repositories {
15 | mavenLocal()
16 | maven {
17 | url = uri("https://repo.maven.apache.org/maven2/")
18 | }
19 | }
20 |
21 | subprojects {
22 | apply(plugin = "java")
23 | apply(plugin = "org.springframework.boot")
24 | apply(plugin = "io.spring.dependency-management")
25 | apply(plugin = "com.diffplug.spotless")
26 | apply(plugin = "io.freefair.lombok")
27 | }
28 |
--------------------------------------------------------------------------------
/docker/docker-compose-jenkins.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | jenkins:
4 | image: jenkins/jenkins:lts
5 | restart: always
6 | build:
7 | context: .
8 | container_name: jenkins
9 | user: root
10 | privileged: true
11 | ports:
12 | - 9090:8080
13 | - 50000:50000
14 | volumes:
15 | - ./jenkins_home:/var/jenkins_home
16 | - /var/run/docker.sock:/var/run/docker.sock
17 |
--------------------------------------------------------------------------------
/docker/docker-compose-mariadb.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | db_master:
5 | image: mariadb:10.6 # mariadb 10.6 버전 이미지 사용
6 | container_name: db_master # container 이름 설정
7 | restart: always
8 | environment:
9 | MARIADB_ROOT_PASSWORD: aroundhub12# # container 생성 후 root의 비밀번호를 저장한 파일을 설정함으로서 root 비밀번호를 설정
10 | MARIADB_DATABASE: springboot
11 | MARIADB_USER: flature
12 | MARIADB_PASSWORD: aroundhub12#
13 | volumes:
14 | - ./master_db/data:/var/lib/mysql # 각종 log와 index등이 volume이 저장되는 디렉토리
15 | - ./master_db/config/:/etc/mysql/conf.d # 이전에 나왔던 ./master/config/my.cnf 를 써줌으써 설정을 reference해줍니다.
16 | ports:
17 | - '3306:3306' # 이 옵션은 docker engine에게 각 container에게 포트를 수동으로 설정하게 해줍니다.
18 |
19 | db_slave:
20 | image: mariadb:10.6 # mariadb 10.6 버전 이미지 사용
21 | container_name: db_slave # container 이름 설정
22 | restart: always
23 | environment:
24 | MARIADB_ROOT_PASSWORD: aroundhub12#
25 | MARIADB_DATABASE: springboot
26 | MARIADB_USER: flature
27 | MARIADB_PASSWORD: aroundhub12#
28 | volumes:
29 | - ./slave_db/data:/var/lib/mysql
30 | - ./slave_db/config/:/etc/mysql/conf.d
31 | ports:
32 | - '3307:3306'
33 | depends_on:
34 | - db_master # depends_on은 실행 순서에 대한 정의입니다. 다만 서비스가 온전히 실행됐는지 검증하진 않아 별도 처리가 필요할 수 있습니다.
35 |
36 | # docker-compose -f docker-compose-mariadb.yml up -d
37 |
--------------------------------------------------------------------------------
/docker/docker-compose-redis.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | aroundhub_redis:
5 | image: redis:7.0.0
6 | restart: always
7 | ports:
8 | - '6379:6379'
9 | # docker-compose -f docker-compose-redis.yml up -d
10 |
--------------------------------------------------------------------------------
/docker/master_db/config/my.cnf:
--------------------------------------------------------------------------------
1 | [mysqld]
2 | server-id=1
3 | log-bin=mysql-bin
4 | log-basename=master1
--------------------------------------------------------------------------------
/docker/slave_db/config/my.cnf:
--------------------------------------------------------------------------------
1 | [mysqld]
2 | server-id=2
3 | log-bin=mysql-bin
4 | log-basename=master1
5 | report-host=slave1
--------------------------------------------------------------------------------
/document/Swagger Annotations Changes:
--------------------------------------------------------------------------------
1 |
2 | @Api -> @Tag
3 | @ApiIgnore -> @Parameter(hidden = true) or @Operation(hidden = true) or @Hidden
4 | @ApiImplicitParam -> @Parameter
5 | @ApiImplicitParams -> @Parameters
6 | @ApiModel -> @Schema
7 | @ApiModelProperty(hidden = true) -> @Schema(accessMode = READ_ONLY)
8 | @ApiModelProperty -> @Schema
9 | @ApiOperation(value = "foo", notes = "bar") -> @Operation(summary = "foo", description = "bar")
10 | @ApiParam -> @Parameter
11 | @ApiResponse(code = 404, message = "foo") -> @ApiResponse(responseCode = "404", description = "foo")
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Around-Hub-Studio/around-hub-spring-boot/f773d68fadb56668da96b93ce6463f97edf7fd49/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Stop when "xargs" is not available.
209 | if ! command -v xargs >/dev/null 2>&1
210 | then
211 | die "xargs is not available"
212 | fi
213 |
214 | # Use "xargs" to parse quoted args.
215 | #
216 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
217 | #
218 | # In Bash we could simply go:
219 | #
220 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
221 | # set -- "${ARGS[@]}" "$@"
222 | #
223 | # but POSIX shell has neither arrays nor command substitution, so instead we
224 | # post-process each arg (as a line of input to sed) to backslash-escape any
225 | # character that might be a shell metacharacter, then use eval to reverse
226 | # that process (while maintaining the separation between arguments), and wrap
227 | # the whole thing up as a single "set" statement.
228 | #
229 | # This will of course break if any of these variables contains a newline or
230 | # an unmatched quote.
231 | #
232 |
233 | eval "set -- $(
234 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
235 | xargs -n1 |
236 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
237 | tr '\n' ' '
238 | )" '"$@"'
239 |
240 | exec "$JAVACMD" "$@"
241 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if %ERRORLEVEL% equ 0 goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if %ERRORLEVEL% equ 0 goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | set EXIT_CODE=%ERRORLEVEL%
84 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
85 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
86 | exit /b %EXIT_CODE%
87 |
88 | :mainEnd
89 | if "%OS%"=="Windows_NT" endlocal
90 |
91 | :omega
92 |
--------------------------------------------------------------------------------
/http/http-client.env.json:
--------------------------------------------------------------------------------
1 | {
2 | "env123": {
3 | "base-url": "http://localhost:8080"
4 | },
5 |
6 | "env124": {
7 | "base-url": "http://localhost:8080"
8 | }
9 | }
--------------------------------------------------------------------------------
/http/reactive/MethodArgumentExample.http:
--------------------------------------------------------------------------------
1 | ### /user-gent
2 | GET {{base-url}}/argument/user-agent
3 |
4 | ### /echo
5 | POST http://localhost:8080/argument/echo
6 | Content-Type: application/json
7 |
8 | {
9 | "name": "flature",
10 | "org": "around hub studio"
11 | }
12 |
13 | ### /custom-response
14 | GET http://localhost:8080/argument/custom-response
--------------------------------------------------------------------------------
/mvc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | group = "studio.thinkground.aroundhub.mvc"
2 | version = "1.0.0"
3 | java.sourceCompatibility = JavaVersion.VERSION_17
4 |
5 | spotless {
6 | format("yaml") {
7 | target("**.*.yaml", "**/*.yml")
8 | prettier().configFile("${rootDir}/.prettierrc")
9 | }
10 | java {
11 | removeUnusedImports()
12 | googleJavaFormat()
13 | importOrder(
14 | "java",
15 | "jakarta",
16 | "lombok",
17 | "org.springframework",
18 | "",
19 | "\\#",
20 | "studio.thinkground",
21 | "\\#studio.thinkground"
22 | )
23 | indentWithTabs(2)
24 | indentWithSpaces(2)
25 | trimTrailingWhitespace()
26 | endWithNewline()
27 | }
28 | }
29 |
30 | repositories {
31 | mavenLocal()
32 | maven {
33 | url = uri("https://repo.maven.apache.org/maven2/")
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation("org.springframework.boot:spring-boot-starter-web")
39 | implementation("org.springframework.boot:spring-boot-starter-data-jpa")
40 | implementation("org.springframework.boot:spring-boot-starter-validation")
41 | implementation("org.springframework.boot:spring-boot-starter-data-redis")
42 |
43 | // https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui
44 | implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.4.0")
45 |
46 | implementation("com.google.code.gson:gson:2.10.1")
47 | implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5")
48 |
49 | implementation("org.mariadb.jdbc:mariadb-java-client")
50 |
51 | testImplementation("org.springframework.boot:spring-boot-starter-test")
52 | }
53 |
54 | tasks.withType() {
55 | options.encoding = "UTF-8"
56 | }
57 |
58 | tasks.test {
59 | useJUnitPlatform()
60 | systemProperties["spring.profiles.active"] = "test"
61 | }
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/Application.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Application.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/CommonResponse.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common;
2 |
3 | public enum CommonResponse {
4 | SUCCESS(0, "Success"),
5 | FAIL(-1, "Fail");
6 |
7 | int code;
8 | String msg;
9 |
10 | CommonResponse(int code, String msg) {
11 | this.code = code;
12 | this.msg = msg;
13 | }
14 |
15 | public int getCode() {
16 | return code;
17 | }
18 |
19 | public String getMsg() {
20 | return msg;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/Constants.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common;
2 |
3 | public class Constants {
4 |
5 | public enum ExceptionClass {
6 | PRODUCT("Product"),
7 | SIGN("Sign");
8 |
9 | private String exceptionClass;
10 |
11 | ExceptionClass(String exceptionClass) {
12 | this.exceptionClass = exceptionClass;
13 | }
14 |
15 | public String getExceptionClass() {
16 | return exceptionClass;
17 | }
18 |
19 | @Override
20 | public String toString() {
21 | return getExceptionClass() + " Exception. ";
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/annotation/FieldAnnotation.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.FIELD)
10 | public @interface FieldAnnotation {
11 | String name();
12 |
13 | String value();
14 | }
15 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/annotation/MethodAnnotation.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.METHOD)
10 | public @interface MethodAnnotation {
11 | String name();
12 |
13 | String value() default "I'm Method";
14 | }
15 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/annotation/TypeAnnotation.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.TYPE)
10 | public @interface TypeAnnotation {
11 | String name();
12 |
13 | String value();
14 | }
15 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/annotation/ValidationAnnotation.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import jakarta.validation.Constraint;
9 | import jakarta.validation.Payload;
10 |
11 | import studio.thinkground.aroundhub.mvc.common.valid.ParameterValidator;
12 |
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target(ElementType.FIELD)
15 | @Constraint(validatedBy = ParameterValidator.class)
16 | public @interface ValidationAnnotation {
17 | String message() default "Invalid Value. It should be 'hello'";
18 |
19 | Class>[] groups() default {};
20 |
21 | Class extends Payload>[] payload() default {};
22 | }
23 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/exception/AroundHubException.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.exception;
2 |
3 | import org.springframework.http.HttpStatus;
4 |
5 | import studio.thinkground.aroundhub.mvc.common.Constants;
6 |
7 | public class AroundHubException extends Exception {
8 |
9 | private static final long serialVersionUID = 4663380430591151694L;
10 |
11 | private Constants.ExceptionClass exceptionClass;
12 | private HttpStatus httpStatus;
13 |
14 | public AroundHubException(
15 | Constants.ExceptionClass exceptionClass, HttpStatus httpStatus, String message) {
16 | super(exceptionClass.toString() + message);
17 | this.exceptionClass = exceptionClass;
18 | this.httpStatus = httpStatus;
19 | }
20 |
21 | public Constants.ExceptionClass getExceptionClass() {
22 | return exceptionClass;
23 | }
24 |
25 | public int getHttpStatusCode() {
26 | return httpStatus.value();
27 | }
28 |
29 | public String getHttpStatusType() {
30 | return httpStatus.getReasonPhrase();
31 | }
32 |
33 | public HttpStatus getHttpStatus() {
34 | return httpStatus;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/mvc/src/main/java/studio/thinkground/aroundhub/mvc/common/exception/AroundHubExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package studio.thinkground.aroundhub.mvc.common.exception;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.http.HttpHeaders;
7 | import org.springframework.http.HttpStatus;
8 | import org.springframework.http.ResponseEntity;
9 | import org.springframework.web.bind.annotation.ExceptionHandler;
10 | import org.springframework.web.bind.annotation.RestControllerAdvice;
11 |
12 | import org.slf4j.Logger;
13 | import org.slf4j.LoggerFactory;
14 |
15 | @RestControllerAdvice
16 | public class AroundHubExceptionHandler {
17 |
18 | private final Logger LOGGER = LoggerFactory.getLogger(AroundHubExceptionHandler.class);
19 |
20 | @ExceptionHandler(value = Exception.class)
21 | public ResponseEntity