gpt4 book ai didi

Spring-Boot-Devtools 不想重新加载进程(没有选择正确的类路径?)

转载 作者:行者123 更新时间:2023-12-04 11:34:54 25 4
gpt4 key购买 nike

我有一个小的 Spring Boot 项目(来自 spring-boot-starter)。一切都配置好了,我想使用 Spring-Boot-Devtools 进行自动重新加载。
当我从我的 git repo 工作目录启动我的项目 (mvn spring-boot:run -X) 时,我可以看到:

Maven日志:

DEBUG] Classpath for forked process: C:\Users\razor\git\spring-boot-starter\target\classes;........



没关系,路径看起来不错。
然后应用程序日志:

2016-09-21 23:47:59.568 DEBUG 13528 --- [ restartedMain] .b.l.ClasspathLoggingApplicationListener : Application started with classpath: []



类路径为空?可能这就是 Devtools 不想自动重新加载我的应用程序的问题。但为什么 ?

当我将项目文件夹(没有其他更改!!!)复制到其他地方时,重新加载工作!

Maven (mvn spring-boot:run -X):

[DEBUG] Classpath for forked process: C:\Java\workspace_rentit\spring-boot-starter2\target\classes;.....



然后:

2016-09-21 23:40:34.224 DEBUG 4060 --- [ restartedMain] .b.l.ClasspathLoggingApplicationListener : Application started with classpath [file:/C:/Java/workspace_rentit/spring-boot-starter2/target/classes/]



为什么会有差异?怎么了 ?在第二种情况下,重新加载工作。

最佳答案

Spring Boot 在考虑是否应该自动重启时会忽略某些项目名称。这是 described in the documentation :

When deciding if an entry on the classpath should trigger a restart when it changes, DevTools automatically ignores projects named spring-boot, spring-boot-devtools, spring-boot-autoconfigure, spring-boot-actuator, and spring-boot-starter



您应该重命名您的项目,以便清楚它不是 Spring Boot 本身的一部分并且有资格自动重启。

关于Spring-Boot-Devtools 不想重新加载进程(没有选择正确的类路径?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39634422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com