Get it done in one minute: spring boot hot deployment (based on Idea)

What is hot deployment?

  • For the spring boot project, modify the java class in the background, do not restart the entire project, you can test/use the newly modified function!

How to add/set up hot deployment for the project

  • The maven project adds the following code in pom.xml, and introduces new dependencies on the Internet.
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <version>1.5.12.RELEASE</version>
</dependency>
  • The gradle project adds the following code in build.gradle to introduce new dependencies online.
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '1.5.12.RELEASE'

Some Problems:

  • Is the hot deployment complete?
    • It's as simple as that when it's done, after all, spring boot
  • how to use?
    • After starting the project, try to modify the java code, such as changing the business logic in the service layer, outputting some console information, etc. (modifying the lower-level code such as mybatis sql, database corresponding entities, enumeration classes, etc. will cause hot deployment to fail or be invalid)
    • Click the Build Projectbutton (on the left side of the project start button, the shortcut key is ctrl+f9)
    • After about 2 seconds, the lower left corner of the idea prompts xx classes reloaded
    • The modified new features are ready to use!
  • How to modify Build Projectshortcut keys?
    http://www.cnblogs.com/kangkaii/p/8419080.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324638628&siteId=291194637