Class DefaultRestartInitializer

java.lang.Object
org.springframework.boot.devtools.restart.DefaultRestartInitializer
All Implemented Interfaces:
RestartInitializer

public class DefaultRestartInitializer extends Object implements RestartInitializer
Default RestartInitializer that only enable initial restart when running a standard "main" method. Skips initialization when running "fat" jars (included exploded) or when running from a test.
Since:
1.3.0
Author:
Phillip Webb, Andy Wilkinson
  • Constructor Details

    • DefaultRestartInitializer

      public DefaultRestartInitializer()
  • Method Details

    • getInitialUrls

      public URL[] getInitialUrls(Thread thread)
      Description copied from interface: RestartInitializer
      Return the initial set of URLs for the Restarter or null if no initial restart is required.
      Specified by:
      getInitialUrls in interface RestartInitializer
      Parameters:
      thread - the source thread
      Returns:
      initial URLs or null
    • isMain

      protected boolean isMain(Thread thread)
      Returns if the thread is for a main invocation. By default checks the name of the thread and the context classloader.
      Parameters:
      thread - the thread to check
      Returns:
      true if the thread is a main invocation
      See Also:
    • isMainThread

      protected boolean isMainThread(Thread thread)
      Returns whether the given thread is considered to be the main thread.
      Parameters:
      thread - the thread to check
      Returns:
      true if it's the main thread, otherwise false
      Since:
      2.4.0
    • isDevelopmentClassLoader

      protected boolean isDevelopmentClassLoader(ClassLoader classLoader)
      Returns whether the given classLoader is one that is typically used during development.
      Parameters:
      classLoader - the ClassLoader to check
      Returns:
      true if it's a ClassLoader typically used during development, otherwise false
      Since:
      2.4.0
    • getUrls

      protected URL[] getUrls(Thread thread)
      Return the URLs that should be used with initialization.
      Parameters:
      thread - the source thread
      Returns:
      the URLs