我有以下java类:
@ContextConfiguration(locations = { "classpath:/pathToXml" })
public class AbstractServiceTest extends AbstractTransactionalJUnit4SpringContextTests {
@Autowired
protected SessionFactory sessionFactory;
@Autowired
protected MyBean myBean;
public Integer doSomething(){
return myBean.returnVeryImportantInteger();
}
...
}
如果我写new AbstractServiceTest ()
sessionFactory 为空。(在 pathToXml 中写入的 sessionFacory 信息)
我怎么能说春天它看到了配置"classpath:/pathToXml"
?
@ContextConfiguration(locations = { "classpath:/anotherPathToXml" })
public class MyClass
public void myMethod(){
// I want to use here method doSomething from AbstractServiceTest class
}
}