This allows other bootstrap application listeners to resolve the
spring.application.name during the bootstrap phase, but allows bootstrap
to determine if the context is the bootstrap context.
fixes gh-214
Also adjusts bootstrap listener to be smarter about default
properties:
It's better not to use the default properties at all because the
user might pass some in and we don't want to overwrite them. Before
Boot 2.0 we got away with it, but since 2.0 we have to be more
cautious.
Instead it depends on ContextRefresher with actually does the work.
This allows applications to use the listener even if they don't depend
on actuator.
fixes gh-171
The fix for gh-153 was sensible, but has now exposed another issue
which is that the bootstrap initializers, whilst they are now only
created once, actually only get applied to the parent context
in a hierarchy.
Most of the time this doesn't matter because the child contexts all
benefit from environment changes and additional beans added
to the parent. If the children are supposed to actually have
different environments, though, there is a problem. So this change
locates the existing bootstrap context and applies it to each
new context created separately.
Unfortunately we have to use reflection to do that for now because
there is no way to discover the parent with a public API before
the context is refreshed.
See gh-190
For RefreshScope this stops Spring from moaning about the @Bean
method with a WARN log (which is benign but hard to get rid of
and confusing for users).
See gh-401