spring-boot2.0 单元测试JUnit4

简单在spring-boot2.0版本中使用junit
源码如下:
@SpringBootTest(classes = DemoT002Application.class) 只要加上这个就能使用DemoT002Application.class是你的程序入口文件

@RunWith(SpringJUnit4Cla***unner.class) // SpringJUnit支持,由此引入Spring-Test框架支持! @SpringBootTest(classes = DemoT002Application.class)public class Account_Bank_DaoTest { @Autowired private Account_Bank_Dao account_Bank_Dao; @Test public void test() throws Exception { String a = account_Bank_Dao.getById(); System.out.println(a); }}