配置spring.profiles.active切換正式環境和測試環境

 

application-xx配置文件中配置

spring.profiles.active=${ENV}

運行環境的配置:Run/Debug Configurations中指定ENV值

測試類中的配置:@ActiveProfiles

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("dev")
public class DemoApplicationTests {
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章