Programmatically restart Spring Boot application / Refresh Spring Context

后端 未结 6 1593
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 15:43

I am trying to programmatically restart my Spring Application without having the user to intervene.

Basically, I have a page which allows to switch the mode of the a

6条回答
  •  借酒劲吻你
    2020-12-03 16:08

    I've solved this issue by using Restarter from Spring Devtools. Add this to pom.xml:

    
        org.springframework.boot
        spring-boot-devtools
        runtime
    
    

    Then use org.springframework.boot.devtools.restart.Restarter to call this:

    Restarter.getInstance().restart();
    

    It works for me. Hope this help.

提交回复
热议问题