您是否学习过Spring参考文档中的“
测试”一章?这是您应该从以下示例开始的示例:
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfigurationpublic class MyTest { @Resource private FooService fooService; // class body...}如果您
com.example.MyTest进入
/src/test/java,则需要
/src/test/resources/com/example/MyTest-context.xml-但例外情况将向您显示方式。



