Ich benutze eine Spring-Boot-App, die meine src/main/resources/config/application.yml ausführt.Lade verschiedene application.yml in SpringBoot Test
Wenn ich meinen Testfall ausgeführt von:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest
public class MyIntTest{
}
Die Testcodes noch meine application.yml Datei ausführen Eigenschaften zu laden. Ich frage mich, ob es möglich ist, eine andere * .yml-Datei auszuführen, wenn Sie den Testfall ausführen.
nette Antwort !. Es funktioniert .... Vielen Dank – Exia
Dies ist die richtige Antwort. Die Annotation TestPropertySource funktioniert nur für die Datei .properties oder .xml. Siehe "Unterstützte Dateiformate Abschnitte" in https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/test/context/TestPropertySource.html – Sam