Spring Boot has a Devtools package which will turn on useful developer features such as autoreload in an IDE. It will disable itself in the fully packaged application.
Where are the technical details about how Spring Boot Devtools determines whether to become active, and more importantly, how can my application detect at runtime whether Devtools is active?
I believe you are looking for the
DevToolsEnablementDeducerwhich determines if dev tools is enabled within a specific thread based off the current stack and what is excluded by default.Also, when built as a jar the
spring-boot-maven-pluginwill exclude the dependency if configured properly:Likewise, with gradle the recommended way of enabling also does not include when its packaged:
This means that if you choose to still include the dependency into your produced jar, then dev tools will then activate based off the existing
LocalDevToolsAutoConfigurationwhich is loaded via the imports.