dockerspring-bootintellij-ideaspring-boot-devtools

Spring Boot Devtools auto restart error


I'm following this guide https://medium.com/@lhartikk/development-environment-in-spring-boot-with-docker-734ad6c50b34 to try and get auto restart, live reload and remote debugging working with my simple spring boot application in a local docker container. I'm getting an error when the auto restart is triggered:

Exception in thread "File Watcher" java.lang.IllegalStateException: Unexpected 404 response uploading class files

Dockerfile:

FROM openjdk
VOLUME /tmp
ADD target/learn-docker-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java","-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

Run command:

docker build -t learn_docker .
docker run -p 8080:8080 -d learn_docker

Solution

  • I finally found the solution! You have to put the application context on the arguments of the IDE RemoteSpringApplication configuration.

    For example, my application root context was /virtue so I had to configure it like so: Example