Spring-Boot-Devtools不想重新加载过程(不选择正确的类路径吗?) [英] Spring-Boot-Devtools doesn't want to reload process (doesn't pick up proper classpaths?)

查看:201
本文介绍了Spring-Boot-Devtools不想重新加载过程(不选择正确的类路径吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a small Spring Boot project (from spring-boot-starter). Everything configured, i want to use Spring-Boot-Devtools for automatic reloading. When i launch my project (mvn spring-boot:run -X) from my git repo working dir, i can see:

行家日志:

DEBUG]分叉进程的类路径: C:\ Users \ razor \ git \ spring-boot-starter \ target \ classes; ........

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

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

that's ok, path looks good. and then app logs:

2016-09-21 23:47:59.568调试13528 --- [restartedMain] .b.l.ClasspathLoggingApplicationListener:应用程序以类路径启动:[]

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

classpath为空?可能就是Devtools不想自动重新加载我的应用程序的问题.但是为什么呢?

classpath empty? probably that's the problem that Devtools doesn't want to automatically reload my app. But why ?

当我将项目文件夹(没有其他更改!!)复制到其他位置时,重新加载即可!

When i copy project folder (no other alterations !!!) to other place, reloading works !

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

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

[DEBUG]分叉进程的类路径: C:\ Java \ workspace_rentit \ spring-boot-starter2 \ target \ classes; .....

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

及更高版本:

2016-09-21 23:40:34.224调试4060 --- [restartedMain] .blClasspathLoggingApplicationListener:应用程序以类路径启动[文件:/C:/Java/workspace_rentit/spring-boot-starter2/target /classes/]

为什么有差异?怎么了 ?在第二种情况下,重新加载即可.

Why are there differences? What's wrong ? in second case, reloading works.

推荐答案

好吧,在摆弄项目几分钟后,我发现问题可能出在项目文件夹名称为"spring-boot-starter" (来自Eclipse Spring Boot Creator的默认项目名称?) 这就是为什么在其他文件夹中进行重新加载(项目文件夹名称也有所不同)的原因,在我的git repo下更改了项目文件夹名称后,重新开始重新工作.

Ok, after fiddling with a project for a few more minutes, i've found that probably the problem is the project folder name 'spring-boot-starter' (default project name from eclipse spring boot creator?) that's why reloading in different folder worked (project folder name was different too), after changing project folder name under my git repo, reloading started to work again.

是否已记录功能"? :)

Is it documented 'feature' ? :)

看起来不应将项目的目录命名为"spring-boot -....". (它与工件名称或Eclipse项目名称无关)

looks like project's DIRECTORY shouldn't be named 'spring-boot-....' (it's not connected with artifact name or eclipse project name)

这篇关于Spring-Boot-Devtools不想重新加载过程(不选择正确的类路径吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆