如何在静态@BeforeClass中自动布线字段?
2022-08-31 20:12:48
@RunWith(SpringJUnit4ClassRunner.class)
public void ITest {
@Autowired
private EntityRepository dao;
@BeforeClass
public static void init() {
dao.save(initialEntity); //not possible as field is not static
}
}
如何将我的服务注入到静态初始化类中?