我想通过在Chrome中添加org.springframework.boot:spring-boot-devtools
依赖项和LiveReload扩展来使用Spring Boot Tools的自动重新启动和Live Reload功能。有关更多信息,请参阅此https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3。但是,这不起作用,因为当我从STS或命令提示符运行Gradle任务时,应用程序已启动(并且在http://localhost:8080上可用),但是任务的启动永远不会结束,并且永远不会通过70%/ 80%标记。这可以防止自动重新启动功能。为什么我的Spring Boot应用程序的bootRun任务不能在Gradle中完全运行?
我的gradle文件看起来像这样。该项目的完整源代码可以在GitHub中找到,请参阅https://github.com/marinusgeuze/metjekindnaarbuiten/tree/master/backend/springboot。
============================================== ================
buildscript {
ext { springBootVersion = '1.4.3.BUILD-SNAPSHOT' }
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('se.transmode.gradle:gradle-docker:1.2')
}
}
group = 'marinusgeuze'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker'
jar {
baseName = 'metjekindnaarbuiten-spring-boot-docker'
version = '0.1.0'
}
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-devtools")
compile("com.h2database:h2")
}
你为什么这样做?只需从STS直接运行应用程序即可。 –
某个问题的答案很简单。你是完全正确的。只要去项目>调试为>春季启动应用程序,它的工作原理。在Chrome中安装LiveReload插件,效果很好。非常感谢。 –