-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from Hous-Release/develop
release 1.0.6
- Loading branch information
Showing
26 changed files
with
1,406 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
mysql: | ||
image: mysql/mysql-server:5.7 | ||
environment: | ||
MYSQL_ROOT_HOST: '%' | ||
MYSQL_USER: "hous" | ||
MYSQL_PASSWORD: "hous" | ||
MYSQL_DATABASE: "hous" | ||
ports: | ||
- "3306:3306" | ||
command: | ||
- "mysqld" | ||
- "--character-set-server=utf8mb4" | ||
- "--collation-server=utf8mb4_unicode_ci" | ||
|
||
redis: | ||
image: redis:alpine | ||
command: redis-server --port 6379 | ||
container_name: redis_boot | ||
hostname: redis_boot | ||
labels: | ||
- "name=redis" | ||
- "mode=standalone" | ||
ports: | ||
- 6379:6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommon/aspect/PreventDuplicateRequest.java → ...ct/duplicate/PreventDuplicateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/hous/server/common/aspect/logging/LoggingAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package hous.server.common.aspect.logging; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Pointcut; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.context.request.RequestContextHolder; | ||
import org.springframework.web.context.request.ServletRequestAttributes; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import java.util.Enumeration; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Aspect | ||
@Component | ||
@Slf4j | ||
public class LoggingAspect { | ||
|
||
/** | ||
* execution([수식어] 리턴타입 [클래스이름].이름(파라미터) | ||
* * : 모든 값 포함 | ||
* .. : 0개 이상 의미 | ||
* <p> | ||
* hous.server.controller 패키지 내부의 모든 클래스에서 파라미터가 0개 이상인 모든 메서드 | ||
*/ | ||
@Pointcut("execution(* hous.server.controller..*(..))") | ||
public void controllerExecute() { | ||
} | ||
|
||
@Around("hous.server.common.aspect.logging.LoggingAspect.controllerExecute()") | ||
public Object requestLogging(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { | ||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); | ||
long startAt = System.currentTimeMillis(); | ||
Object returnValue = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs()); | ||
long endAt = System.currentTimeMillis(); | ||
log.info("====> Request: {} {} ({}ms)\n *Header = {}\n", request.getMethod(), request.getRequestURL(), endAt - startAt, getHeaders(request)); | ||
if (returnValue != null) { | ||
log.info("====> Response: {}", returnValue); | ||
} | ||
return returnValue; | ||
} | ||
|
||
private Map<String, Object> getHeaders(HttpServletRequest request) { | ||
Map<String, Object> headerMap = new HashMap<>(); | ||
|
||
Enumeration<String> headerArray = request.getHeaderNames(); | ||
while (headerArray.hasMoreElements()) { | ||
String headerName = headerArray.nextElement(); | ||
headerMap.put(headerName, request.getHeader(headerName)); | ||
} | ||
return headerMap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.