错误:
SpringBoot项目,单元测试的时候,报错:
java.io.FileNotFoundException: Could not open ServletContext resource [/config.properties]
原因:
这个原因不是config.properties配置找不到,而是项目中存在@PropertySource注解
@PropertySource("config.properties")
解决办法:
将
@PropertySource("config.properties")
改成
@PropertySource("classpath:config.properties")