-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: logback 설정 변경 및 discord 메시지 배포환경에서만 적용
- Loading branch information
1 parent
a406d02
commit 01ccf74
Showing
6 changed files
with
81 additions
and
12 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,43 @@ | ||
package com.gt.genti.aop; | ||
|
||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Before; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.gt.genti.config.auth.UserDetailsImpl; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Aspect | ||
@Component | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class EnvAop { | ||
|
||
private final Environment env; | ||
|
||
@Before("@annotation(com.gt.genti.aop.annotation.CheckUserIsQuit) && args(userDetailsImpl)") | ||
public void checkUserIsQuit(final UserDetailsImpl userDetailsImpl) { | ||
log.info("유저탈퇴확인aop실행"); | ||
if (!userDetailsImpl.isEnabled()) { | ||
throw new RuntimeException("탈퇴한 사용자입니다."); | ||
} | ||
} | ||
|
||
@Around("@annotation(com.gt.genti.aop.annotation.DeployOnly)") | ||
public Object deployOnly(ProceedingJoinPoint joinPoint) throws Throwable { | ||
String[] activeProfiles = env.getActiveProfiles(); | ||
for (String profile : activeProfiles) { | ||
if ("deploy".equals(profile)) { | ||
return joinPoint.proceed(); | ||
} | ||
} | ||
|
||
return null; | ||
|
||
} | ||
} |
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,12 @@ | ||
package com.gt.genti.aop.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.METHOD, ElementType.TYPE}) | ||
public @interface DeployOnly { | ||
|
||
} |
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
6 changes: 5 additions & 1 deletion
6
.../com/gt/genti/service/DiscordLogTest.java → ...enti/service/DiscordLog_LocalEnvTest.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