I´ve using JUnit but some tests have some issues, these tests have @Autowired annotation inside the Spring beans and when i reference them the beans that are @Autowired were alw
Try running your unit tests with a spring runner instead.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:config/applicationContext.xml",
"classpath:config/test-datasources.xml"})
public class MyTest {
@Autowired private IManager manager;
@Test public void someTest() {
assertNotNull(manager);
}
}
It will load the config only once and when needed, and it will autowire your junit class