在单元测试类中修改@SpringBootTest的内容如下:

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐