Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hot swapping in Spring Boot in Visual Studio Code

Tags:

spring

I just started a Spring Boot project with Angular 4. And for Angular I can run npm start so that NPM compiles every change. But I can't figure out how to do that for Spring Boot. I can find some sources for Eclipse/IntelliJ but I would like to stay with my Visual Studio Code editor.

like image 500
Peter Boomsma Avatar asked Sep 10 '17 18:09

Peter Boomsma


2 Answers

A little late for this but I was searching for the same and got here. Maybe this could be useful for someone else.

The answer for that is in the documentation of spring.

Read here:

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-hotswapping.html

And then here:

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html

In case you have problems with the links...

If your'e using Maven just add this dependency in your pom:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>

Or if you're using Gradle:

dependencies {
    compile("org.springframework.boot:spring-boot-devtools")
}

I hope this helps someone.

like image 89
Julio Lago Avatar answered Nov 15 '22 08:11

Julio Lago


Open VSCode options (Ctrl+,) and search for 'hot code replace'. At Java Debugger, switch to 'auto'. enter image description here

like image 38
Mário Calegaro Avatar answered Nov 15 '22 07:11

Mário Calegaro