解決intellij中sPRing boot工程 無(wú)法用mainapplication啟動(dòng)問(wèn)題
一、spring boot 工程 從svn庫(kù)導(dǎo)出到 intellij idea中 后用mainApplication中的main函數(shù)啟動(dòng)時(shí)會(huì)出現(xiàn)
Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer的錯(cuò)誤 原因是 intellij idea中 工程的tomcat需要再次配置一下pom.xml 配置了jar包后,intellij idea 不會(huì)自動(dòng)引入的
選擇 File -> Project Structure->Modules->Dependencies
找到 tomcat-embed-core 的jar包 作用域默認(rèn)是provided ,把它改為 compile。
然后我們?cè)賠un 一下 MainApplication 就可以啟動(dòng)了。
二、我們可以不用java的方式啟動(dòng),采用maven打包的方式啟動(dòng)
點(diǎn)擊界面右上角 ManApplication 選擇 edit Config
點(diǎn)擊 左上方的 綠色的加號(hào)
把maven配置上去 然后 command line 輸入 spring-boot:run 勾選share或者single instance only 點(diǎn)擊確定
你就會(huì)看到 intellij右上角 會(huì)有兩種切換,一種是MainApplication 一種是剛剛添加的maven
現(xiàn)在用 剛剛配置的 自己命名的maven 啟動(dòng)就可以了
tips:這樣的啟動(dòng)是 先打包再啟動(dòng),開(kāi)發(fā)時(shí)候不太方便。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注