@Profile

Java/Spring · 2021. 1. 8. 11:31
//application.properties
spring.profiles.default=dev
print.profiles.active=prod


// Config.java
@PropertySource("classpath:application.properties")
@Configuration
public class Config {
    @Bean
    public void standardBean() {
    	System.out.println("Standard bean created");
    }
    
    @Bean
    public void developmentBean() {
    	System.out.println("Development bean created");
    }
    
    @Bean
    public void standardProduction() {
    	System.out.println("Production bean created");
    }

}

'Java > Spring' 카테고리의 다른 글

Spring WebClient vs RestTemplate  (0) 2021.01.10