Class DefaultRestartInitializer
- java.lang.Object
- org.springframework.boot.devtools.restart.DefaultRestartInitializer
- All Implemented Interfaces:
RestartInitializer
public class DefaultRestartInitializer extends Object implements RestartInitializer
DefaultRestartInitializerthat 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
Field Summary
Fields inherited from interface org.springframework.boot.devtools.restart.RestartInitializer
NONE
Constructor Summary
Constructors Constructor Description DefaultRestartInitializer()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URL[]getInitialUrls(Thread thread)Return the initial set of URLs for theRestarterornullif no initial restart is required.protected URL[]getUrls(Thread thread)Return the URLs that should be used with initialization.protected booleanisMain(Thread thread)Returns if the thread is for a main invocation.protected booleanisSkippedStackElement(StackTraceElement element)Checks if a specificStackTraceElementshould cause the initializer to be skipped.
Constructor Detail
DefaultRestartInitializer
public DefaultRestartInitializer()
Method Detail
getInitialUrls
public URL[] getInitialUrls(Thread thread)
Description copied from interface:RestartInitializerReturn the initial set of URLs for theRestarterornullif no initial restart is required.- Specified by:
getInitialUrlsin interfaceRestartInitializer- 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:
trueif the thread is a main invocation
isSkippedStackElement
protected boolean isSkippedStackElement(StackTraceElement element)
Checks if a specificStackTraceElementshould cause the initializer to be skipped.- Parameters:
element- the stack element to check- Returns:
trueif the stack element means that the initializer should be skipped