最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

AutoConfigureMockMvc+SpringBootTest自動(dòng)注入MockMvc始終報(bào)找不到MockMvc bean,求指導(dǎo)

https://img1.sycdn.imooc.com//5adf3e4a00019a0a18360570.jpg

問(wèn)題如圖,自動(dòng)注入MockMvc失敗

正在回答

1 回答

這是我可以運(yùn)行的文件,希望對(duì)你有幫助...

package?com.chengsluo.demo.controller;

import?org.junit.Test;
import?org.junit.runner.RunWith;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import?org.springframework.boot.test.context.SpringBootTest;
import?org.springframework.test.context.junit4.SpringRunner;
import?org.springframework.test.web.servlet.MockMvc;
import?org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import?org.springframework.test.web.servlet.result.MockMvcResultMatchers;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc

public?class?GrilControllerTest?{

???@Autowired
???private?MockMvc?mockMvc;

???@Test
???public?void?girlsList()?throws?Exception?{
??????mockMvc.perform(MockMvcRequestBuilders.get("/girls"))
????????????.andExpect(MockMvcResultMatchers.status().isOk());
//??????????.andExpect(MockMvcResultMatchers.status().string("213"));
???}
}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_流浪_1 提問(wèn)者

已發(fā)現(xiàn)問(wèn)題,我用的springboot2.0.1有webflux新特性,同樣代碼再1.4是不會(huì)有問(wèn)題的,thx
2018-04-25 回復(fù) 有任何疑惑可以回復(fù)我~
#2

非洲白白 回復(fù) qq_流浪_1 提問(wèn)者

怎么解決的啊兄弟
2018-05-24 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

AutoConfigureMockMvc+SpringBootTest自動(dòng)注入MockMvc始終報(bào)找不到MockMvc bean,求指導(dǎo)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)