@SpringBootTest
@RunWith(SpringRunner.class)//@RunWith(SpringRunner.class)这些类才能实例化到spring容器中,自动注入才能生效,不然会报异常
public class DictDaoTest extends TestCase {
@Autowired
private DictDao dao;
@Test
public void getByIdText(){
Dict dict = dao.getById(1l);
System.out.println("=================================="+dict);
}
}
测试结果:
==================================Dict{type='sex', k='0', val='女'}