Spring - MVC - modified Java classes, triggering restart

1 Overview

  1. Learning Spring MVC, how to trigger a controlled restart

2. Background

  1. Learning Spring
    1. Scenes
      1. In some cases, completely change the class, you need to restart
    2. Have heard before, Spring MVC can automatically restart
    3. So I would like to try it and see how to configure

3. Environment

  1. the
    1. win10
  2. jdk
    1. 1.8
  3. here
    1. east 2018.1
  4. spring
    1. spring boot
      1. 2.1.7 release
    2. Package
      1. thymeleaf
      2. starter-web
      3. devtool
      4. starter-test
  5. browser
    1. firefox
      1. 70.0
  6. ref
    1. spring in action 5th

4. Configure

  1. application.properties
    1. Outline
      1. Spring modify configuration files
    2. content

      # 添加内容
      spring.devtools.restart.enabled=true
    3. trigger
      1. As long as the modified compiler can trigger
        1. ctrl + f9
  2. other
    1. Idea may also be arranged behind autobuilder
      1. But I think, or forget
        1. You are a slacker, you are not or manually trigger it?
        2. Shutdown and restart is also okay shortcuts
  3. Be explain it
    1. Restart Devtools next Spring Boot
      1. Restart
        1. This restart, first of all much more quickly than restart
          1. Because Spring class loader with two
          2. Restart, then only one restart, just in general is that Java code
    2. Automatic compilation
      1. This frequency may sometimes be less good control
        1. time
        2. Storage
      2. But if I want to change multiple files at once, and then restart
        1. Is not the case, there will be more to restart a few times ...
        2. If the project is large, it will not be too much trouble

ps

  1. Or give yourself a task
    1. Available configurations automatically compile the idea, learn a science

Guess you like

Origin www.cnblogs.com/xy14/p/11755744.html