Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring启动:热插拔不起作用_Java_Spring_Gradle_Spring Boot_Jetty - Fatal编程技术网

Java Spring启动:热插拔不起作用

Java Spring启动:热插拔不起作用,java,spring,gradle,spring-boot,jetty,Java,Spring,Gradle,Spring Boot,Jetty,我正在使用SpringBoot1.3.2和gradle插件。在我的多部分项目中,热交换/重新加载HTML/JS/CSS文件不起作用 /resources |-wro.groovy |-application.yml |-/templates/(all *.html files and index.html) |-/static/ |-/js/ |-/css/ application.yml server: port: 8080 spring: t

我正在使用SpringBoot1.3.2和gradle插件。在我的多部分项目中,热交换/重新加载HTML/JS/CSS文件不起作用

/resources
  |-wro.groovy
  |-application.yml
  |-/templates/(all *.html files and index.html)
  |-/static/
      |-/js/
      |-/css/
application.yml

server:
 port: 8080

spring:
  thymeleaf:
    cache: false
    prefix: classpath:/templates/
    suffix: .html
    enabled: true
    encoding: UTF-8
    mode: HTML5
在te项目中也使用:wro4j、thymeleaf、AngularJS

gradle.build的一部分

buildscript {
    ext { springBootVersion = '1.3.2.RELEASE' }
    repositories {
        maven {
            url "https://ourartifactoryUrl/plugins-release"
            credentials {
                // artifactory log and pass
            }
        }
    }
    dependencies {
        classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: springBootVersion
        classpath group: 'io.spring.gradle', name: 'dependency-management-plugin', version: '0.5.2.RELEASE'
        classpath group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.+'
        classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'

    }
}

apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'idea'
apply plugin: 'application'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'


...


dependencies {
   compile('org.springframework.boot:spring-boot-starter-web')
   compile("org.springframework.boot:spring-boot-starter-thymeleaf")
   compile("org.springframework.boot:spring-boot-starter-jetty")
   compile("org.springframework.boot:spring-boot-starter-actuator")
   compile("org.springframework.boot:spring-boot-starter-redis")
   compile("org.springframework.boot:spring-boot-devtools")
}
执行项目时使用:
gradle:web管理员:bootRun

更新/回答:


在网上冲浪和阅读SpringBoot文档之后,我发现了一个窍门。 使用中出现问题,因此我只需在我的gradle.build中添加几行:

    // Used by 'Spring Boot Gradle Plugin' in combination with 'Devtools' makes HTML/JS/CSS reloadable.
    bootRun {
        addResources = true
    }

在网上冲浪和阅读SpringBoot文档之后,我发现了一个窍门。将devtools与spring boot gradle插件一起使用时出现问题,因此我只需在gradle.build文件中添加几行:

// Used by 'Spring Boot Gradle Plugin' in combination with 'Devtools' makes HTML/JS/CSS reloadable.
bootRun {
    addResources = true
}

我也遇到了同样的问题,通过将应用程序属性中的
spring.thymeleaf.cache
设置为
false

如何修复


在您的
应用程序.properties
文件中添加
spring.thymeleaf.cache=false
,这与我的设置(使用Maven在Eclipse中运行)有很大不同,我不确定细节,但请检查您的应用程序是否在打包的jar中而不是在开发类路径中提供文件。检查更新。找到一个窍门。如果这为你解决了问题,那么将其作为答案发布并接受。发布,但我不能接受。有一个最短时间;大约一天后就可以使用了。在我的例子中,它是
sourceResources sourceset.main
中提到的。