本文共 1093 字,大约阅读时间需要 3 分钟。
org.springframework spring-context 5.2.7.RELEASE org.projectlombok lombok 1.16.18 junit junit 4.9 test org.springframework spring-test 3.2.4.RELEASE provided
@RunWith(SpringJUnit4ClassRunner.class)public class SpringTest {}
@ContextConfiguration 注解:
locations 属性:用于指定配置文件的位置。如果是类路径下,需要用 classpath:表明classes 属性:用于指定注解的类。当不使用 xml 配置时,需要用此属性指定注解类的位置。
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations= {"classpath:bean.xml"})public class SpringTest {}
转载地址:http://gsphn.baihongyu.com/