私は私の春ブーツメインクラスを持っている:オーバーライド@PropertySource
@SpringBootApplication
@PropertySource("file:/my/file/properties")
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
//main method
}
私は(@PropertySource
を使用して)外部ファイルからプロパティを読んでいます。今、私は統合テストがあります。
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes= Application.class)
@WebIntegrationTest
@TestPropertySource("file:/my/test/file/properties") // <---
public class MyTest {
//some tests
}
を私はApplication
クラスで@PropertySource
に示されているとは異なり、別の外部プロパティファイルを使用する必要があります。そのため、私は@TestPropertySource
を追加しましたが、この注釈は@PropertySource
を上書きしていないようです。
どうすればよいですか?
ありがとうございます。
ありがとうございました。できます。 –