2025 年 11 月,Spring Boot 4.0 正式发布,spring-boot-autoconfigure拆成了47个小模块,详细说明见https://blog.csdn.net/m0_46995061/article/details/156986027.
由于以上原因@AutoConfigureMockMvc默认不可用,MockMvc以前使用方式不能注入,百度,AI等没有搜到答案。在以上文章的引导下,加入包引用
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
问题解决,如有其它类似情况可以举一反三试试。其原因是细分模块,减少包大小所至 。

1万+

被折叠的 条评论
为什么被折叠?



