在我将Rest Controller Advice附加到模拟mvc的Setup方法中,然后抛出以下异常 java.lang.NoClassDefFoundError:org / springframework / web / context / request / async / AsyncRequestTimeoutException
@RunWith(MockitoJUnitRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AccountDetailsControllerTest {
@Mock
private AccountDetailService accountDetailService;
private MockMvc mockMvc;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
this.mockMvc = standaloneSetup(new
AccountDetailsController(accountDetailService))
.setControllerAdvice(new ExceptionControllerAdvice())
.build();
}
}
答案 0 :(得分:0)
谢谢大家,这是Spring依赖的问题。我使用的是4.3.1版本的spring-web和spring boot 1.5.7版本需要4.3.11。