Spring MVC+Junit測試出錯---@WebAppConfiguration

Spring MVC+Junit測試出錯: WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[c....................

--在單元測試時報錯WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[c....................,在網上查詢各類資料,最後是經過一個註解掃面了資源文件後編譯正常;app

--修改前單元測試

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class JpaSpecificationExecutorTest {



--修改後
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
@WebAppConfiguration("src/main/resources")//掃描了resources配置文件夾裏面的配置,後恢復正常
public class JpaSpecificationExecutorTest {
相關文章
相關標籤/搜索