contextconfiguration专题

spring的@ContextConfiguration注解

在junit测试的时候,我们需要测试spring的内容时,需要用到@RunWith和@ContextConfiguration两个注解。 在这里介绍下通过注解注入的bean和原生springContext获取到的bean是同一对象。 @RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations = {"file:

The attribute locations is undefined for the annotation type ContextConfiguration

程序中有这么一块代码: */@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations = { "/conf/spring/*.xml" })public class SearchConsumptionInDayImplTest extends BaseJunit 报错: The attribute l