Intellij,Spring开发工具远程,Docker,错误意外404响应上传类文件 [英] Intellij, Spring dev tools remote, Docker, error Unexpected 404 response uploading class files

查看:400
本文介绍了Intellij,Spring开发工具远程,Docker,错误意外404响应上传类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Spring Boot Dev工具(Spring Remote),并自动将重新编译的文件上传到我的docker容器。

Im trying to use Spring Boot Dev tools (Spring Remote), and automatically upload recompiled files to my docker container.

我一直收到
意外的404响应上传类文件

这是我的泊坞文件:

FROM java:8
WORKDIR /first
ADD ./build/libs/first.jar /first/first.jar
EXPOSE 8080
RUN bash -c 'touch /first/first.jar'
ENTRYPOINT ["java","-Dspring.data.mongodb.uri=mongodb://mongodb/micros", "-Djava.security.egd", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005","-jar", "first.jar"]

这是我的配置和配置

This is my configuration and the configuration

这是我收到的错误:

推荐答案

从Spring Boot 1.5.0开始,devtools默认值被更改为从胖罐中排除devtools。

As of Spring Boot 1.5.0, devtools defaults were changed to exclude the devtools from fat jars.

如果你想要包含它们,你必须将 excludeDevtools 标志设置为false。

If you want to include them, you have to set the excludeDevtools flag to false.

但是,devtools文档没有解释如何做到这一点。必要的文档实际上在spring-boot-gradle-plugin文档中。

However, the devtools documentation doesn't explain how to do this. The necessary documentation is actually in the spring-boot-gradle-plugin documentation.

为此,您可以将这段代码放在build.gradle文件中: / p>

To do it, you can put this snippet of code in your build.gradle file:

bootRepackage {
    excludeDevtools = false
}

不幸的是,这起初是错误的,并且从Spring Boot 1.5.0开始没有效果。解决方法是这样做:

Unfortunately, this was buggy at first and had no effect as of Spring Boot 1.5.0. The workaround was to do this instead:

springBoot {
    excludeDevtools = false
}

但是,我已经验证了 bootRepackage 方法适用于Spring启动1.5.8。

However, I have verified that the bootRepackage approach works for Spring Boot 1.5.8 .

这篇关于Intellij,Spring开发工具远程,Docker,错误意外404响应上传类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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