[英]Cannot overrid Spring-Boot application properties in Junit Test
I am trying override application properties, file is here: test/resources/test.properties
我正在尝试覆盖应用程序属性,文件在这里: test/resources/test.properties
@TestPropertySource(locations="classpath:test.properties")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@WebAppConfiguration
public abstract class ApplicationAbstractTest {
But when I run any tests - they look for applicaton properties (and don't see VM options app.conf): 但是,当我运行任何测试时,它们会寻找applicaton属性(并且看不到VM选项app.conf):
@PropertySource(value = "file:${app.conf}")
@SpringBootApplication
public class Application {
How correctly config this? 如何正确配置?
在@PropertySource(value = "file:${app.conf}")
添加ignoreResourceNotFound = true
后,此问题已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.