我希望通过在Chrome中添加org.springframework.boot:spring-boot-devtools
依赖项和LiveReload扩展程序来使用Spring Boot Tools的自动重新启动和实时重新加载功能。有关详细信息,请参阅此https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3。但是,这不起作用,因为当我从STS运行bootRun
Gradle任务或命令提示符启动应用程序(并在http://localhost:8080上可用)时,任务的启动永远不会完成,并且永远不会通过70%/ 80%大关。这会阻止自动重启功能。
我的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")
}
答案 0 :(得分:0)
有时问题的答案非常简单。你完全正确。只需转到Project> Debug As> Spring Boot App,它的工作原理。在Chrome中安装LiveReload插件,效果很好。非常感谢。