兩種運行方式
springboot 的項目(組建)有兩種方式。
其中第1個能很方便地debug
但是, 跟spring 的插件thymeleaf (代替mvc)沖突.
第一種方式運行時, 會找不到項目的網(wǎng)頁資源文件。
第二鐘方法能避免呢個問題, 但系default沒有提供調(diào)試功能。
解決方法
1. 在pom.xml 添加remote debug的屬性
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
2.在Idea(現(xiàn)在流行這個, 應(yīng)該講大部分網(wǎng)上視頻用呢個ide)run - Edit configuration 的截面, 添加1個remote的item
什么也不用改,按默認(rèn)就得
3. 其實配置完成, 用mvn: springboot:run 運行項目
4.在debug工具欄, 選擇剛剛新建的遠(yuǎn)程debug 項目, 然后按debug按鈕
小結(jié)
吳復(fù)雜, 就系要同時啟動兩個項目, 1個本項目, 1個遠(yuǎn)程調(diào)試…