Class Restarter


  • public class Restarter
    extends Object
    Allows a running application to be restarted with an updated classpath. The restarter works by creating a new application ClassLoader that is split into two parts. The top part contains static URLs that don't change (for example 3rd party libraries and Spring Boot itself) and the bottom part contains URLs where classes and resources might be updated.

    The Restarter should be initialized early to ensure that classes are loaded multiple times. Mostly the RestartApplicationListener can be relied upon to perform initialization, however, you may need to call initialize(String[]) directly if your SpringApplication arguments are not identical to your main method arguments.

    By default, applications running in an IDE (i.e. those not packaged as "fat jars") will automatically detect URLs that can change. It's also possible to manually configure URLs or class file updates for remote restart scenarios.

    Since:
    1.3.0
    See Also:
    RestartApplicationListener, initialize(String[]), getInstance(), restart()