Reputation: 10994
How can I replace beans.xml file for testing purposes? I use
@SpringBootApplication
@ImportResource("classpath:Beans.xml")
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
to init class, but in my testing class
@RunWith(SpringRunner.class)
@SpringBootTest
public class ArrayCointainerTest {
I'd like to use another one. Any idea for this?
Upvotes: 2
Views: 274
Reputation: 11017
Define a separate configuration class which has you beans xml imported and annotate that with @TestConfiguration. Spring boot automatically pick this up as your test configuration
Upvotes: 3