-
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.
Browse files
Browse the repository at this point in the history
프로파일 분리 완료
- Loading branch information
Showing
13 changed files
with
198 additions
and
118 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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/munecting/api/global/config/DevConfig.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,11 @@ | ||
package com.munecting.api.global.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.annotation.PropertySource; | ||
|
||
@Configuration | ||
@Profile("dev") | ||
@PropertySource(value = {"classpath:env-common.properties", "classpath:env-dev.properties"}) | ||
public class DevConfig { | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/munecting/api/global/config/EmbeddedRedisConfig.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,47 @@ | ||
package com.munecting.api.global.config; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import jakarta.annotation.PreDestroy; | ||
import org.redisson.Redisson; | ||
import org.redisson.api.RedissonClient; | ||
import org.redisson.config.Config; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import redis.embedded.RedisServer; | ||
|
||
@Configuration | ||
@Profile("test") | ||
public class EmbeddedRedisConfig { | ||
|
||
@Value("${spring.data.redis.host}") | ||
private String host; | ||
|
||
@Value("${spring.data.redis.port}") | ||
private int port; | ||
|
||
private RedisServer redisServer; | ||
|
||
@PostConstruct | ||
public void startEmbeddedRedis() { | ||
redisServer = new RedisServer(port); | ||
redisServer.start(); | ||
} | ||
|
||
@PreDestroy | ||
public void stopEmbeddedRedis() { | ||
if (redisServer != null) { | ||
redisServer.stop(); | ||
} | ||
} | ||
|
||
@Bean | ||
public RedissonClient redissonClient() { | ||
Config config = new Config(); | ||
config.useSingleServer() | ||
.setAddress("redis://" + host + ":" + port); | ||
return Redisson.create(config); | ||
} | ||
|
||
} |
8 changes: 4 additions & 4 deletions
8
...ing/api/global/config/PropertyConfig.java → ...necting/api/global/config/ProdConfig.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.munecting.api.global.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.annotation.PropertySource; | ||
import org.springframework.context.annotation.PropertySources; | ||
|
||
@Configuration | ||
@PropertySources({ | ||
@PropertySource("classpath:env.properties") | ||
}) | ||
public class PropertyConfig { | ||
@Profile("prod") | ||
@PropertySource(value = {"classpath:env-common.properties","classpath:env-prod.properties"}) | ||
public class ProdConfig { | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/munecting/api/global/config/TestConfig.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,12 @@ | ||
package com.munecting.api.global.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.annotation.PropertySource; | ||
import org.springframework.context.annotation.PropertySources; | ||
|
||
@Configuration | ||
@Profile("test") | ||
@PropertySource(value = {"classpath:env-common.properties", "classpath:env-test.properties"}) | ||
public class TestConfig { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
|
||
package com.munecting.api; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
@@ -14,4 +14,4 @@ void contextLoads() { | |
} | ||
|
||
} | ||
*/ | ||
|
Oops, something went wrong.