1. 程式人生 > >spring test: 配置檔案優先順序

spring test: 配置檔案優先順序

 

application.properties 預設

application-xxx.properties 高

systemEnvironment 高

test/main/resources/ 同名檔案 ?

@TestPropertySource 優先順序最高 


https://stackoverflow.com/questions/29669393/override-default-spring-boot-application-properties-settings-in-junit-test
https://www.baeldung.com/properties-with-spring#boot

 

 

@RunWith解釋:   https://github.com/junit-team/junit4/wiki/test-runners#runwith-annotation