【问题标题】:Junit class in spring春季Junit课
【发布时间】:2012-10-14 11:15:32
【问题描述】:

我收到此代码错误:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })

错误:

file not found exception

请帮帮我。

【问题讨论】:

  • 你项目中的applicationContext.xml在哪里?
  • 你可以试试classpath*:applicationContext.xml(见类路径后面的*)...它可能会有所帮助。

标签: java spring junit


【解决方案1】:

您应该搜索 applicationContext.xml 的位置。 它必须在类路径中。我建议您检查它是否在类目录中。如果不是,您应该或将 applicationContext.xml 文件移动到将被过滤到类目录的源文件夹或更改单元测试中的位置。

【讨论】:

    猜你喜欢
    • 2011-09-26
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 2015-11-21
    • 2015-05-04
    • 2018-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多