報錯內容:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
解決方法:
首先,先確保正確創建springboot項目,創建項目是選擇spring Initializr,而不是maven項目
項目創建確保後,在你所運行時需要用的的每個類上方添加@EnableAutoConfiguration
記住,是每個類,而不是main方法這一個類,再次嘗試運行,就可以了!(提示:有的解決方法告訴說刪除依賴的包,那個是完全不可行的,因爲版本是建項目時就選好的,和那個沒關係)