Skip to content

Commit

Permalink
setting: 프로파일별 env.properties 로드 #61
Browse files Browse the repository at this point in the history
  • Loading branch information
mungsil committed Nov 27, 2024
1 parent 192a36f commit 2511f4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/munecting/api/global/config/DevConfig.java
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 {
}
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 {
}
12 changes: 12 additions & 0 deletions src/main/java/com/munecting/api/global/config/TestConfig.java
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 {
}

0 comments on commit 2511f4f

Please sign in to comment.