经过一段时间的摆弄,直到我在Netbeans 8.2中使用Spring Boot 1.4.3进行了适当的调试设置,我想我将其调查结果写为Q& A.问题是Netbeans的默认配置无法在调试模式下正确启动Spring,当您搜索Internet时,您只能在Spring文档中找到不起作用的过时信息.

如果您知道如何解决方案很简单.请在下面找到正确的设置说明.

测试并使用Netbeans 8.2和Spring-Boot 1.4.3:首先确保包含Spring Maven插件(在制作新的Netbeans Spring项目时应该已经包含这个插件):

<plugins>
 ...
 <plugin>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-maven-plugin</artifactId>
 <executions>
 <execution>
 <goals>
 <goal>repackage</goal>
 </goals>
 </execution>
 </executions>
 </plugin>
 ...
</plugins>

同样包含这样的Spring Devtools是个好主意:

<dependencies>
 ...
 <dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-devtools</artifactId>
 </dependency>
 ...
</dependencies>

现在导航到您的项目设置 – >行动 – >调试项目并设置以下内容:

如何使用Maven通过Netbeans调试Spring Boot

执行目标:

spring-boot:run

设置属性:

run.jvmArguments=-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}
jpda.listen=true

现在通过常用的调试按钮运行您的应用程序,Spring应该正确连接到JVM调试器.