first commit
This commit is contained in:
commit
456bf8a768
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@ -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/
|
||||
69
build.gradle
Normal file
69
build.gradle
Normal file
@ -0,0 +1,69 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'war'
|
||||
id 'org.springframework.boot' version '3.2.5'
|
||||
id 'io.spring.dependency-management' version '1.1.4'
|
||||
}
|
||||
|
||||
group = 'com.munjaon'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
|
||||
java {
|
||||
sourceCompatibility = '17'
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3'
|
||||
testImplementation 'org.springframework.batch:spring-batch-test'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
|
||||
implementation 'com.zaxxer:HikariCP:4.0.3'
|
||||
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-cache
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache:3.2.5'
|
||||
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
|
||||
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
// https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2
|
||||
implementation 'org.apache.commons:commons-configuration2:2.10.1'
|
||||
// https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils
|
||||
implementation 'commons-beanutils:commons-beanutils:1.9.4'
|
||||
// https://mvnrepository.com/artifact/io.netty/netty-all
|
||||
implementation 'io.netty:netty-all:4.1.42.Final'
|
||||
|
||||
testCompileOnly 'org.projectlombok:lombok'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// profile의 기본값 local로 설정
|
||||
ext.profile = (!project.hasProperty('profile') || !profile) ? 'local' : profile
|
||||
|
||||
// 리소스 디렉토리 추가
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDirs "src/main/resources/${profile}"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
249
gradlew
vendored
Normal file
249
gradlew
vendored
Normal file
@ -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=SC2039,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=SC2039,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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
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" "$@"
|
||||
92
gradlew.bat
vendored
Normal file
92
gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = 'munjaon_server'
|
||||
@ -0,0 +1,23 @@
|
||||
package com.munjaon.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
public class MunjaonServerApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MunjaonServerApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
return super.configure(builder);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.munjaon.server.api.controller;
|
||||
|
||||
import com.munjaon.server.api.dto.SampleDto;
|
||||
import com.munjaon.server.api.dto.base.ApiResponse;
|
||||
import com.munjaon.server.api.service.SampleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RequestMapping("/api")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class SampleController {
|
||||
private final SampleService sampleService;
|
||||
|
||||
@PostMapping("/sample")
|
||||
public ResponseEntity postSample(@RequestBody SampleDto sample) throws ConfigurationException {
|
||||
log.debug("sample : {}", sampleService.get());
|
||||
System.out.println("command : " + sample.getCommand());
|
||||
|
||||
/* 설정 Load */
|
||||
sampleService.printConfig();
|
||||
|
||||
return new ResponseEntity(ApiResponse.toResponse(200, "OK", sample), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
12
src/main/java/com/munjaon/server/api/dto/SampleDto.java
Normal file
12
src/main/java/com/munjaon/server/api/dto/SampleDto.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.munjaon.server.api.dto;
|
||||
|
||||
import com.munjaon.server.api.dto.base.BaseDto;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class SampleDto extends BaseDto {
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.munjaon.server.api.dto.base;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ApiResponse<T> {
|
||||
/* 응답코드 */
|
||||
private Integer code;
|
||||
/* 응답 메시지 */
|
||||
private String message;
|
||||
/* Response 객체 */
|
||||
private T data;
|
||||
|
||||
public ApiResponse(final Integer code, final String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> toResponse(final Integer code, final String message, final T t) {
|
||||
return ApiResponse.<T>builder().code(code)
|
||||
.message(message)
|
||||
.data(t)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/munjaon/server/api/dto/base/BaseDto.java
Normal file
13
src/main/java/com/munjaon/server/api/dto/base/BaseDto.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.munjaon.server.api.dto.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class BaseDto {
|
||||
protected String command;
|
||||
protected String authKey;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.munjaon.server.api.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SampleMapper {
|
||||
int get();
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.munjaon.server.api.service;
|
||||
|
||||
import com.munjaon.server.api.mapper.SampleMapper;
|
||||
import com.munjaon.server.cache.service.MemberService;
|
||||
import com.munjaon.server.config.ServerConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SampleService {
|
||||
private final SampleMapper sampleMapper;
|
||||
|
||||
private final ServerConfig serverConfig;
|
||||
|
||||
private final MemberService memberService;
|
||||
|
||||
public int get() {
|
||||
return sampleMapper.get();
|
||||
}
|
||||
|
||||
public void printConfig() throws ConfigurationException {
|
||||
log.info("server.run : {}", serverConfig.getString("server.run"));
|
||||
log.info("sms.queue.count : {}", serverConfig.getInt("sms.queue.count"));
|
||||
log.info("member list : {}", memberService.list());
|
||||
log.info("member get : {}", memberService.get("006star"));
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/munjaon/server/cache/dto/MemberDto.java
vendored
Normal file
26
src/main/java/com/munjaon/server/cache/dto/MemberDto.java
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
package com.munjaon.server.cache.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class MemberDto {
|
||||
private String mberId;
|
||||
private String esntlId;
|
||||
private String mberSttus;
|
||||
private String dept;
|
||||
private float shortPrice;
|
||||
private float longPrice;
|
||||
private float picturePrice;
|
||||
private float picture2Price;
|
||||
private float picture3Price;
|
||||
private float kakaoAtPrice;
|
||||
private float kakaoFtPrice;
|
||||
private float kakaoFtImgPrice;
|
||||
private float kakaoFtWideImgPrice;
|
||||
private float faxPrice;
|
||||
private float userMoney;
|
||||
}
|
||||
35
src/main/java/com/munjaon/server/cache/mapper/MemberMapper.java
vendored
Normal file
35
src/main/java/com/munjaon/server/cache/mapper/MemberMapper.java
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
package com.munjaon.server.cache.mapper;
|
||||
|
||||
import com.munjaon.server.cache.dto.MemberDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MemberMapper {
|
||||
/**
|
||||
* 회원테이블 마지막으로 변경된 시간 조회
|
||||
* @return
|
||||
*/
|
||||
String getLastModifiedTime(String tableSchema);
|
||||
|
||||
/**
|
||||
* 회원 전체 목록
|
||||
* @return
|
||||
*/
|
||||
List<MemberDto> list();
|
||||
|
||||
/**
|
||||
* 회원조회
|
||||
* @param mberId
|
||||
* @return
|
||||
*/
|
||||
MemberDto get(String mberId);
|
||||
|
||||
/**
|
||||
* 회원상태 업데이트
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int updateStts(MemberDto params);
|
||||
}
|
||||
89
src/main/java/com/munjaon/server/cache/service/MemberService.java
vendored
Normal file
89
src/main/java/com/munjaon/server/cache/service/MemberService.java
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
package com.munjaon.server.cache.service;
|
||||
|
||||
import com.munjaon.server.cache.dto.MemberDto;
|
||||
import com.munjaon.server.cache.mapper.MemberMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MemberService {
|
||||
private final MemberMapper memberMapper;
|
||||
|
||||
/**
|
||||
* 회원테이블 마지막으로 변경된 시간 조회
|
||||
* @return
|
||||
*/
|
||||
public String getLastModifiedTime(String tableSchema) {
|
||||
return memberMapper.getLastModifiedTime(tableSchema);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 전체 목록
|
||||
* @return
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
@Cacheable("cacheMember")
|
||||
public List<MemberDto> list() {
|
||||
return memberMapper.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원조회
|
||||
* @param mberId
|
||||
* @return
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
@Cacheable(value = "cacheMember", key = "#mberId")
|
||||
public MemberDto get(String mberId) {
|
||||
return memberMapper.get(mberId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 Cache 전체 삭제
|
||||
*/
|
||||
@CacheEvict(value = "cacheMember", allEntries = true)
|
||||
public void deleteAllMember(){
|
||||
log.info("Cache All Clear");
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 Cache 아이디 삭제
|
||||
* @param mberId
|
||||
*/
|
||||
@CacheEvict(value = "cacheMember", key = "#mberId")
|
||||
public void deleteOneMember(final String mberId){
|
||||
log.info("Cache Clear: {}", mberId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원상태 업데이트
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public int updateStts(MemberDto params) {
|
||||
return memberMapper.updateStts(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원상태 업데이트
|
||||
* @param mberId
|
||||
* @param mberSttus
|
||||
* @return
|
||||
*/
|
||||
public int updateStts(String mberId, String mberSttus) {
|
||||
MemberDto params = new MemberDto();
|
||||
params.setMberId(mberId);
|
||||
params.setMberSttus(mberSttus);
|
||||
|
||||
return memberMapper.updateStts(params);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.munjaon.server.config;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(basePackages= "com.munjaon.server.**.mapper")
|
||||
public class DataSourceConfig {
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Primary
|
||||
@Bean(name = "datasource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.server")
|
||||
public DataSource dataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "factory")
|
||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
|
||||
sqlSessionFactory.setVfs(SpringBootVFS.class);
|
||||
sqlSessionFactory.setDataSource(dataSource);
|
||||
sqlSessionFactory.setTypeAliasesPackage("com.munjaon.server.**.dto");
|
||||
sqlSessionFactory.setConfigLocation(applicationContext.getResource("classpath:mybatis-config.xml"));
|
||||
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:/sqlmap/**/*.xml"));
|
||||
return sqlSessionFactory.getObject();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "sqlSession")
|
||||
public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
50
src/main/java/com/munjaon/server/config/ServerConfig.java
Normal file
50
src/main/java/com/munjaon/server/config/ServerConfig.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.munjaon.server.config;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||
import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent;
|
||||
import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
|
||||
import org.apache.commons.configuration2.builder.fluent.Parameters;
|
||||
import org.apache.commons.configuration2.event.Event;
|
||||
import org.apache.commons.configuration2.event.EventListener;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
import org.apache.commons.configuration2.reloading.PeriodicReloadingTrigger;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerConfig {
|
||||
@Value("${agent.server-property-file}")
|
||||
private String serverProperyFile;
|
||||
|
||||
private ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration> builder;
|
||||
|
||||
@PostConstruct
|
||||
void init() throws ConfigurationException {
|
||||
log.info("serverProperyFile : {}", serverProperyFile);
|
||||
builder = new ReloadingFileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(new Parameters().fileBased().setFile(new File(serverProperyFile)));
|
||||
|
||||
builder.addEventListener(ConfigurationBuilderEvent.CONFIGURATION_REQUEST, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
log.info("builder.getConfiguration() is Called!!");
|
||||
}
|
||||
});
|
||||
|
||||
PeriodicReloadingTrigger configReloadingTrigger = new PeriodicReloadingTrigger(builder.getReloadingController(), null, 1, TimeUnit.SECONDS);
|
||||
configReloadingTrigger.start();
|
||||
}
|
||||
|
||||
public String getString(String key) throws ConfigurationException {
|
||||
return builder.getConfiguration().getString(key);
|
||||
}
|
||||
|
||||
public int getInt(String key) throws ConfigurationException {
|
||||
return builder.getConfiguration().getInt(key, 3);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.munjaon.server.netty.config;
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public interface BaseConfig {
|
||||
NioEventLoopGroup bossGroup();
|
||||
NioEventLoopGroup workerGroup();
|
||||
InetSocketAddress port();
|
||||
ServerBootstrap serverBootstrap();
|
||||
ChannelInboundHandlerAdapter handler();
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.munjaon.server.netty.handler;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
||||
public class SampleHandler extends SimpleChannelInboundHandler<String> {
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext channelHandlerContext, String s) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.netty.init;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
|
||||
public class SampleNettyInitializer extends ChannelInitializer<Channel> {
|
||||
@Override
|
||||
protected void initChannel(Channel channel) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,18 @@
|
||||
package com.munjaon.server.queue.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class BasicMessageDto {
|
||||
protected String userMsgID = "";
|
||||
protected String userSender = "";
|
||||
protected String userReceiver = "";
|
||||
protected String userMessage = "";
|
||||
protected String userMsgType = "";
|
||||
protected String userRequestDate = "";
|
||||
protected String sendStatus = "0";
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.queue.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class KakaoMessageDto extends BasicMessageDto {
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.munjaon.server.queue.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class MmsMessageDto extends BasicMessageDto {
|
||||
private String userSubject = "";
|
||||
private int userFileCnt = 0;
|
||||
private String userFileName01 = "";
|
||||
private String userFileName02 = "";
|
||||
private String userFileName03 = "";
|
||||
private int userFileSize01 = 0;
|
||||
private int userFileSize02 = 0;
|
||||
private int userFileSize03 = 0;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.munjaon.server.queue.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum QueueService {
|
||||
SMS_QUEUE,
|
||||
LMS_QUEUE,
|
||||
MMS_QUEUE,
|
||||
KAKAO_QUEUE;
|
||||
|
||||
private Object service;
|
||||
|
||||
public void setService(Object service) {
|
||||
this.service = service;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.queue.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class KakaoQueueService {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.queue.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LmsQueueService {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.queue.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MmsQueueService {
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.munjaon.server.queue.service;
|
||||
|
||||
import com.munjaon.server.queue.enums.QueueService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
@Component
|
||||
public class QueueServiceInjector {
|
||||
@Autowired
|
||||
private SmsQueueService smsQueueService;
|
||||
@Autowired
|
||||
private LmsQueueService lmsQueueService;
|
||||
@Autowired
|
||||
private MmsQueueService mmsQueueService;
|
||||
@Autowired
|
||||
private KakaoQueueService kakaoQueueService;
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
for (QueueService svc : EnumSet.allOf(QueueService.class)) {
|
||||
switch (svc) {
|
||||
case SMS_QUEUE: svc.setService(smsQueueService);
|
||||
break;
|
||||
case LMS_QUEUE: svc.setService(lmsQueueService);
|
||||
break;
|
||||
case MMS_QUEUE: svc.setService(mmsQueueService);
|
||||
break;
|
||||
case KAKAO_QUEUE: svc.setService(kakaoQueueService);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.munjaon.server.queue.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SmsQueueService {
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.munjaon.server.scheduler.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SchedulerMapper {
|
||||
int get();
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.munjaon.server.scheduler.service;
|
||||
|
||||
import com.munjaon.server.cache.service.MemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CacheScheduleService {
|
||||
private final MemberService memberService;
|
||||
|
||||
@Value("${agent.db-name}")
|
||||
private String tableSchema;
|
||||
/* 사용자 테이블 마지막 업데이트 시간 */
|
||||
private String member_last_modified_time = null;
|
||||
|
||||
@Scheduled(cron="0/5 * * * * *")
|
||||
public void doService() throws Exception {
|
||||
doMemberService();
|
||||
}
|
||||
|
||||
private void doMemberService() {
|
||||
if (member_last_modified_time == null) {
|
||||
log.info("Member List Info is First Caching~~~");
|
||||
memberService.deleteAllMember();
|
||||
// memberService.list();
|
||||
|
||||
/* 회원 정보 마지막 변경시간 저장 */
|
||||
member_last_modified_time = memberService.getLastModifiedTime(tableSchema);
|
||||
return;
|
||||
}
|
||||
|
||||
/* 변경이 없는 경우 */
|
||||
if (member_last_modified_time.equals(memberService.getLastModifiedTime(tableSchema))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* 테이블에 변경이 있는 경우 */
|
||||
log.info("Member List Info is Delete And Caching~~~");
|
||||
memberService.deleteAllMember();
|
||||
// memberService.list();
|
||||
/* 회원 정보 마지막 변경시간 저장 */
|
||||
member_last_modified_time = memberService.getLastModifiedTime(tableSchema);
|
||||
}
|
||||
}
|
||||
11
src/main/resources/application.yml
Normal file
11
src/main/resources/application.yml
Normal file
@ -0,0 +1,11 @@
|
||||
spring:
|
||||
application:
|
||||
name: munjaon_server
|
||||
profiles:
|
||||
default: local
|
||||
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
type-aliases-package: com.munjaon.server.**.dto
|
||||
mapper-locations: classpath:/sqlmap/**/*.xml
|
||||
16
src/main/resources/dev/application-dev.yml
Normal file
16
src/main/resources/dev/application-dev.yml
Normal file
@ -0,0 +1,16 @@
|
||||
spring:
|
||||
datasource:
|
||||
server:
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent
|
||||
username: mjonUr_agent
|
||||
password: mjagent123$
|
||||
|
||||
server:
|
||||
port: 8090
|
||||
shutdown: graceful
|
||||
|
||||
# ### 에이전트 설정 관련 ####################################################################################
|
||||
agent:
|
||||
server-property-file: C:/apps/agent_server/config/server.properties
|
||||
db-name: mjon_agent_back
|
||||
16
src/main/resources/local/application-local.yml
Normal file
16
src/main/resources/local/application-local.yml
Normal file
@ -0,0 +1,16 @@
|
||||
spring:
|
||||
datasource:
|
||||
server:
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent_back
|
||||
username: mjonUr_agent
|
||||
password: mjagent123$
|
||||
|
||||
server:
|
||||
port: 8090
|
||||
shutdown: graceful
|
||||
|
||||
# ### 에이전트 설정 관련 ####################################################################################
|
||||
agent:
|
||||
server-property-file: C:/apps/agent_server/config/server.properties
|
||||
db-name: mjon_agent_back
|
||||
80
src/main/resources/logback-spring.xml
Normal file
80
src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<timestamp key="BY_DATE" datePattern="yyyy-MM-dd"/>
|
||||
<property name="LOG_PATTERN"
|
||||
value="[%d{yyyy-MM-dd HH:mm:ss}:%-4relative] %green([%thread]) %highlight(%-5level) %boldWhite([%C.%M:%yellow(%L)]) - %msg%n%ex"/>
|
||||
|
||||
<springProfile name="local">
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<logger name="com.munjaon.server" level="DEBUG" />
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="prod|dev">
|
||||
<appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>./log/info/info-${BY_DATE}.log</file>
|
||||
<filter class = "ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>INFO</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern> ./backup/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>3GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE-WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>./log/warn/warn-${BY_DATE}.log</file>
|
||||
<filter class = "ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>WARN</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern> ./backup/warn/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>3GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>./log/error/error-${BY_DATE}.log</file>
|
||||
<filter class = "ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern> ./backup/error/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>3GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="FILE-INFO"/>
|
||||
<appender-ref ref="FILE-WARN"/>
|
||||
<appender-ref ref="FILE-ERROR"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
13
src/main/resources/mybatis-config.xml
Normal file
13
src/main/resources/mybatis-config.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
<setting name="mapUnderscoreToCamelCase" value="true" />
|
||||
<setting name="callSettersOnNulls" value="true" />
|
||||
<setting name="jdbcTypeForNull" value="NULL"/>
|
||||
</settings>
|
||||
<!-- <typeAliases>-->
|
||||
<!-- <package name="com.dopco.psm.**.dto" />-->
|
||||
<!-- </typeAliases>-->
|
||||
</configuration>
|
||||
16
src/main/resources/prod/application-prod.yml
Normal file
16
src/main/resources/prod/application-prod.yml
Normal file
@ -0,0 +1,16 @@
|
||||
spring:
|
||||
datasource:
|
||||
server:
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent
|
||||
username: mjonUr_agent
|
||||
password: mjagent123$
|
||||
|
||||
server:
|
||||
port: 8090
|
||||
shutdown: graceful
|
||||
|
||||
# ### 에이전트 설정 관련 ####################################################################################
|
||||
agent:
|
||||
server-property-file: C:/apps/agent_server/config/server.properties
|
||||
db-name: mjon_agent_back
|
||||
54
src/main/resources/sqlmap/member_sql.xml
Normal file
54
src/main/resources/sqlmap/member_sql.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.server.cache.mapper.MemberMapper">
|
||||
<select id="getLastModifiedTime" resultType="String">
|
||||
/* MemberMapper.getLastModifiedTime */
|
||||
SELECT CASE WHEN UPDATE_TIME IS NULL THEN '0' ELSE DATE_FORMAT(UPDATE_TIME, '%Y%m%d%H%i%s') END AS last_modify_time
|
||||
FROM information_schema.tables
|
||||
WHERE TABLE_SCHEMA = #{tableSchema} AND TABLE_NAME = 'lettngnrlmber'
|
||||
</select>
|
||||
<select id="list" resultType="MemberDto">
|
||||
/* MemberMapper.list */
|
||||
SELECT
|
||||
MBER_ID
|
||||
, ESNTL_ID
|
||||
, MBER_STTUS
|
||||
, DEPT
|
||||
, SHORT_PRICE
|
||||
, LONG_PRICE
|
||||
, PICTURE_PRICE
|
||||
, PICTURE2_PRICE
|
||||
, PICTURE3_PRICE
|
||||
, KAKAO_AT_PRICE
|
||||
, KAKAO_FT_PRICE
|
||||
, KAKAO_FT_IMG_PRICE
|
||||
, KAKAO_FT_WIDE_IMG_PRICE
|
||||
, FAX_PRICE
|
||||
, USER_MONEY
|
||||
FROM lettngnrlmber
|
||||
</select>
|
||||
<select id="get" resultType="MemberDto">
|
||||
/* MemberMapper.get */
|
||||
SELECT
|
||||
MBER_ID
|
||||
, ESNTL_ID
|
||||
, MBER_STTUS
|
||||
, DEPT
|
||||
, SHORT_PRICE
|
||||
, LONG_PRICE
|
||||
, PICTURE_PRICE
|
||||
, PICTURE2_PRICE
|
||||
, PICTURE3_PRICE
|
||||
, KAKAO_AT_PRICE
|
||||
, KAKAO_FT_PRICE
|
||||
, KAKAO_FT_IMG_PRICE
|
||||
, KAKAO_FT_WIDE_IMG_PRICE
|
||||
, FAX_PRICE
|
||||
, USER_MONEY
|
||||
FROM lettngnrlmber
|
||||
WHERE MBER_ID = #{mberId}
|
||||
</select>
|
||||
<update id="updateStts" parameterType="MemberDto">
|
||||
UPDATE lettngnrlmber SET MBER_STTUS = #{mberSttus} WHERE MBER_ID = #{mberId}
|
||||
</update>
|
||||
</mapper>
|
||||
8
src/main/resources/sqlmap/sample_sql.xml
Normal file
8
src/main/resources/sqlmap/sample_sql.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.server.api.mapper.SampleMapper">
|
||||
<select id="get" resultType="int">
|
||||
/* SampleMapper.get */
|
||||
SELECT 1
|
||||
</select>
|
||||
</mapper>
|
||||
8
src/main/resources/sqlmap/scheduler_sql.xml
Normal file
8
src/main/resources/sqlmap/scheduler_sql.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.server.scheduler.mapper.SchedulerMapper">
|
||||
<select id="get" resultType="int">
|
||||
/* SchedulerMapper.get */
|
||||
SELECT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,13 @@
|
||||
package com.munjaon.server;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class MunjaonServerApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user