Junit test run in Eclipse but fails with `gradle test`
我正在使用Spring Boot 2,并且正在尝试进行集成测试。
我通过以下方式配置了自定义
1 2 3 4 | @TestPropertySource( locations ="classpath:###/$$$/application-integrationtest.properties" ) @ComponentScan(basePackages = {"###.$$$" }) |
文件在
在Eclipse下运行Junit可以正常工作,但是如果尝试
java.io.FileNotFoundException: class path resource
[###/$$$/application-integrationtest.properties] cannot be opened
because it does not exist
这是怎么回事?
好的,我将属性文件放在
PS:我以前的回答是错误的。 如果我将文件命名为application.properties,则默认文件具有优先级,并且已加载而不是测试文件。