原代码
@SpringBootTest(classes = AdminApplication.class) @RunWith(SpringRunner.class)
修改后
@SpringBootTest(classes = AdminApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @RunWith(SpringRunner.class)
继续报错
Caused by: org.springframework.boot.web.embedded.tomcat.ConnectorStartFailed
....8010
解决:结束掉占用端口的程序 1.打开cmd 在CMD中输入命令:netstat -ano(注:以管理员的身份打开cmd) 2.在cmd中找到你启动的端口号,并记住端口号后面的PID
taskkill /f /t /im 【PID】



