mercredi 1 avril 2015

How to autowire field in static @BeforeClass?


@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
}
}


How can I have my service injected already in the static init class?


Aucun commentaire:

Enregistrer un commentaire