【发布时间】:2018-07-19 03:57:57
【问题描述】:
我有一个使用带有 xml 的经典 spring 配置的应用程序,是否可以仅将 spring boot 用于单元测试?
像这样:
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@ContextConfiguration(locations = { "classpath:security-context.xml",
"classpath:persistence-context-test.xml", "classpath:core-context.xml",
"classpath:web-context.xml" })
@EnableAutoConfiguration
public class SampleTomcatApplicationTests {
@Test
public void testHome() {
}
}
【问题讨论】: