尝试运行Spring Boot Web测试用例时出现异常。 Excpetions:java.lang.NoClassDefFoundError:AsyncRequestTimeoutException

时间:2018-04-17 13:56:48

标签: spring spring-boot spring-test

在我将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();
    }
}

1 个答案:

答案 0 :(得分:0)

谢谢大家,这是Spring依赖的问题。我使用的是4.3.1版本的spring-web和spring boot 1.5.7版本需要4.3.11。