0
運行我的我的測試類春/ Junit的訪問同級類
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:eq-mo-dcc-context-block.xml"})
public class SpringTest {
@Autowired
private DateUtils dateManager;
@Autowired
private RegionFilter filter;
@Autowired
private ApplicationContext appContext;
@Test
public void test_This()
{
Object obj = appContext.getBean("BlockTransformer");
BlockTransformer Trans = (BlockTransformer) obj;
}
一切都非常早期階段但該發生的配置文件中的問題,從其他的Maven模塊/項目訪問豆。不過,我擁有src/test/resources下的所有xml,所以它可以獲取xml。然而,當試圖拿起類文件,我得到:
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [dcc.mdp.DefaultMessageListener] for bean with name 'BlockMessageListener' defined in class path resource [eq-mo-dcc-context-block.xml]; nested exception is java.lang.ClassNotFoundException: dcc.mdp.DefaultMessageListener
該類駐留在同級Maven的模塊中,但不能從測試類回升。如何讓班級意識到自己以外的其他模塊的班級?
你需要明確定義的依賴來運行這個測試套件。 – dharam 2012-03-10 06:18:02