[英]Override default Spring-Boot application.properties settings in Junit Test
[英]Cannot overrid Spring-Boot application properties in Junit Test
我正在嘗試覆蓋應用程序屬性,文件在這里: test/resources/test.properties
@TestPropertySource(locations="classpath:test.properties")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@WebAppConfiguration
public abstract class ApplicationAbstractTest {
但是,當我運行任何測試時,它們會尋找applicaton屬性(並且看不到VM選項app.conf):
@PropertySource(value = "file:${app.conf}")
@SpringBootApplication
public class Application {
如何正確配置?
在@PropertySource(value = "file:${app.conf}")
添加ignoreResourceNotFound = true
后,此問題已解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.