current position:Home>Springboot Foundation (17): hot deployment

Springboot Foundation (17): hot deployment

2022-06-24 09:20:53There is no retreat when sailing against the current


How to turn on hot deployment , Define the hot deployment scope , Turn off hot deployment

Thermal deployment

Start the hot deployment manually

  1. Import dependence
<!-- Thermal deployment -->
  1. After starting the project , Output log , At this time to use postman Initiate request , Output a line of log
     Insert picture description here

  2. At this point, modify the log output , And click the Build Project ( Or shortcut key Ctrl+F9), After hot loading , Make another request , You can see that the log output becomes three lines , Indicates that the hot load is successful .

 Insert picture description here
 Insert picture description here

About hot deployment

Shortcut key Ctrl+F9

  • restart (Restart): Custom development code , Including class , page , Configuration files, etc , Loading position restart Class loader
  • heavy load (Reload):jar package , Loading position base Class loader

Hot deployment only loads the resources customized by the current developer , No load jar resources

Automatically start hot deployment

  1. Check auto build
     Insert picture description here
  2. Click the shortcut key in the blank space Ctrl+Alt+Shift+/, choice Registry
     Insert picture description here
    find, And check the
     Insert picture description here

Hot deployment scope configuration

The default directory that does not trigger restart

  • /META-INF/maven
  • /META-INF/resources
  • /resources
  • /static
  • /public
  • /templates

Custom does not participate in the hot deployment scope

      exclude: static/**, public/**  # Set up files and folders that do not participate in hot deployment 

Disable hot deployment

	public static void main(String[] args) {
		System.setProperty("spring.devtools.restart.enabled","false");, args);

copyright notice
author[There is no retreat when sailing against the current],Please bring the original link to reprint, thank you.

Random recommended