Spring Boot Hot Switch Configuration under Intellij IDEA

 

 

 

Spring Boot Hot Switch Configuration under Intellij IDEA

Believe that many people own Baidu"Idea spring boot hot deployment"The solutions found are as follows:

1. Project Addition Dependencespring-boot-devtools
2.IDEA pressctrl+alt+s——Build,Excution,Deployment——Compiler— SelectionBuild project automatically
3.IDEA pressctrl+shift+a– inputregistry——Compiler— Selectioncompiler.automake.allow.when.app.running

But in fact, is too laggy, and every time you change a little bit of code, it will trigger IDEA to recompile, IDEA will become stuck, and development experience will be bad.

In fact, IDEA provides a pair ofspring-boot-devtoolsCorresponding support, openIDEA——HelpEnter in the pop-up pagespring bootYou can find the document Configure application update policies with devtools.

Actual operation:

1. Introduce dependencies into your spring boot projectspring-boot-devtools
2. Find the main method and run the project.Note that you must run it by clicking main methodAnd not throughmvn spring-boot:runorgradle bootRunAs follows:

Spring Boot Hot Switch Configuration under Intellij IDEA

Spring Boot Hot Switch Configuration under Intellij IDEA

3. After running, we can open it.Run——Edit ConfigurationsInSpringBootLower setupOn Update actionbyUpdate classes and resourcesAs follows:

Spring Boot Hot Switch Configuration under Intellij IDEA

4. After setting up, run through main method, or click Run icon in menu bar, as shown in figure:

Spring Boot Hot Switch Configuration under Intellij IDEA

5. When we modify the code, IDEA will not automatically compile and restart SpringBoot. Instead, we need to click on the bottom left corner.RunColumnUpdate xxx applicationThermal switching will be triggered. Of course, we can also use shortcuts.ctrl+F10。 The following picture:

Spring Boot Hot Switch Configuration under Intellij IDEA

发表评论

电子邮件地址不会被公开。