Previously, the runtime shutdown hook was added as soon as a
shutdown handler was registered. This causes a memory leak in a war
deployment when the application is undeployed as
LoggingApplicationListener always registers a shutdown handler
so the runtime shutdown hook was always registered.
This commit updates the shutdown hook so that the runtime shutdown
hook is only allowed to be added once run() has been called on a
SpringApplication with the shutdown hook enabled. This approach
allows the registerShutdownHook flag on SpringApplication to be a
central point of control for the registration of the runtime shutdown
hook. When that flag is set to false, for example by
SpringBootServletInitializer, the runtime shutdown hook will not
be registered, irrespective of whether other code uses the public
API to add a shutdown handler.
An alternative approach of stopping LoggingApplicationListener from
adding its shutdown handler – for example by adding
logging.register-shutdown-hook=false to the environment – was
considered. This approach was rejected in favor of the centralized
approach described above as it would require every caller that adds
a shutdown handler to deal with the problem.
Closes gh-37096
The GitHub repo, and therefore calendar entry, is named "Tracing"
but our name for the library is "Micrometer Tracing". Configuring
a custom calendarName allows snapshot release dates to be detected.
See gh-37212
Previously, AOT processing failed on processing an immutable
configuration properties that declare several constructors as the core
framework infrastructure tries to resolve the "autowired" constructor
to use, even if the custom code fragments are never going to use it.
This commit workarounds the problem in maintenance releases until a
proper fix is provided in the core framework. When AOT runs, a
SmartInstantiationAwareBeanPostProcessor is added to the bean factory
to provide the constructor to use. This implementation relies on the
same algorithm that the binder uses at runtime.
Closes gh-37283