File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/main/java/com/back/global/config Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 22
33import jakarta .annotation .PostConstruct ;
44import jakarta .annotation .PreDestroy ;
5+ import lombok .extern .log4j .Log4j2 ;
56import org .springframework .context .annotation .Configuration ;
67import org .springframework .context .annotation .Profile ;
78import redis .embedded .RedisServer ;
1718 */
1819@ Configuration
1920@ Profile ({"dev" , "test" })
21+ @ Log4j2
2022public class EmbeddedRedisConfig {
2123
2224 private RedisServer redisServer ;
@@ -26,10 +28,12 @@ public class EmbeddedRedisConfig {
2628 public void startRedis () {
2729 try {
2830 String osName = System .getProperty ("os.name" ).toLowerCase ();
31+ String activeProfile = System .getProperty ("spring.profiles.active" , "dev" );
32+ log .info ("현재환경: " + activeProfile );
2933
30- // Mac 환경이면 embedded-redis 건너뛰고 docker-compose Redis 사용
31- if (osName .contains ("mac" )) {
32- System . out . println ( " Mac 환경 감지 → embedded-redis 비활성화, docker-compose Redis 사용" );
34+ // 운영환경/ Mac 환경이라면 embedded-redis 비활성화
35+ if (osName .contains ("mac" ) || "prod" . equalsIgnoreCase ( activeProfile ) ) {
36+ log . info ( "운영환경/ Mac 환경 감지 → embedded-redis 비활성화, 일반 Redis 사용" );
3337 System .setProperty ("spring.data.redis.port" , "6379" ); // docker-compose 기본 포트
3438 return ;
3539 }
You can’t perform that action at this time.
0 commit comments