This fix for gh-1928 to address a problemw with Log4j was to set
a system property that forces JBoss Logging to use SLF4J. This has the
unwanted side-effect of crashing Glassfish. We no longer support Log4j
so gh-1928 is no longer a concern. However, you can shoot yourself in
the foot by having Logback and Log4j2 on the classpath in that
particular order, but the latter has to be without its
log4j-slf4j-impl module. At this point you don't get any warnings or
error output at startup, but JBoss Logging uses Log4j2 while
everything else uses SLF4J and Logback. As a result, any logging
that's performed through JBoss Logging is silently lost.
Given the problems caused by setting the system property, and the
contrived nature of the arrangement that's necessary to cause a
problem when the property isn't set, this commit updates
LogbackLoggingSystem so that the system property is no longer set.
Closes gh-8669
Update `SpringApplicationBuilder` so that the `sources(...)` method
updates the primary sources. Prior to this commit, the fix for #8910
had the unfortunate side effect of stopping the
`SpringApplicationBuilder` from being used with
`spring.application.main` properties.
Fixes gh-9053
Update `ConfigurationPropertySourcesPropertySource` to no longer use
`try/catch` when checking for valid names. A new `isValid` method has
been introduced to `ConfigurationPropertyName` which is offers better
performance.
Fixes gh-9058
Update the `Binder` to short circuit potentially expensive bean binding
if there are no known child properties. The shortcut can only be applied
when all used `ConfigurationPropertySources` return a non empty
`containsDescendantOf` result. This should be the case for most
Spring Boot applications, the exception being any apps that are running
in a security restricted environment.
Fixes gh-9023
Update `ConfigurationPropertySource` with a `containsDescendantOf`
method that can be used to tell if a source contains any descendants
of the given name.
The result is Optional so that sources that cannot determine a result
may return `empty()`.
The existing `IterableConfigurationPropertiesSource` has a default
implementation that works by iterating the contained values. Most other
sources return `empty()` with the exception of the adapted
`RandomProperySource` with will return true for `random.*` names.
See gh-9023
Update `NoUnboundElementsBindHandler` to also support ignoring
nested properties. This change is required to allow the
`NoUnboundElementsBindHandler` to be used alongside the
`IgnoreNestedPropertiesBindHandler`.
See gh-9000
Create separate `IterableConfigurationPropertySource` and
`ConfigurationPropertySource` interfaces so that it's possible to
work out if a source can truly iterate the values that it contains.
Prior to this commit there was only a single
`ConfigurationPropertySource` interface, which returned an empty
Iterator when values could not be iterated. This design made it
impossible to tell the difference between a source that was empty, and
a source that could not be iterated.
The `ConfigurationPropertySources` class has been updated to adapt
non-enumerable and enumerable Spring PropertySources to the correct
`ConfigurationPropertySource` interface. It also deals with the edge
case of the `SystemPropertySource` running in a security restricted
environment.
Fixes gh-9057
A test to ensure that the updated configuration properties support
correctly expands placeholders using mapped properties.
Prior to the updated support an `application.properties` file of the
form:
my.prefix.some-url=http://github.com
my.prefix.login-url=${my.prefix.some-url}/login
Would not correctly expand the placeholder against the environment
variable `MY_PREFIX_SOME_URL`
Closes gh-2496
Extend `BindFailureAnalyzer` to support the exceptions thrown by the new
configuration properties `Binder`. Origin information is now also
reported when available.
Closes gh-8934
Create a new `Binder` class specifically designed to bind properties
from one or more `ConfigurationPropertySources` to an object.
The binder provides a replacement for `RelaxedBinder` and attempts to
fix the limitations of the previous solution.
Closes gh-8868
Add a new abstraction that represents a source for configuration
properties. The new source is similar to the `Environment` abstraction
provided by Spring Framework but follows a stricter set of rules.
The `ConfigurationPropertySource` provides a uniform view onto a source
and will help to move responsibility for accessing properties in a
"relaxed" way away from the caller.
The `ConfigurationPropertyName` class enforces strict naming rules
that callers must follow when accessing properties. Configuration
names are lowercase, dot separated and may contain dashes. In
addition "indexed" name elements may be defined by using square
brackets.
Mapping is provided to existing Spring PropertySources implemented with
the relaxed rules that users are used to. For example the configuration
property `server.local-host` can still be written in a property files
as `server.localHost` or in an environment variable as SERVER_LOCALHOST.
Closes gh-4910
Move the `Origin` and related classes from `o.s.boot.env` to
`o.s.boot.orgin` and extend support. The concept of an origin can now
be used outside of just the Spring Environment abstraction.
Closes gh-9001
Deprecate `RelaxedDataBinder`, `RelaxedPropertyResolver` and related
classes in preparation for the updated configuration properties binder
work.
See gh-9000
Update `SpringApplication` so that the `sources` property is
independent to the primary source provided on construction.
Prior to this commit the sources property was a little unusual in that
calling set would add to the existing collection.
Closes gh-8910
Refine Mustache support to provide a cleaner separation between the
reactive and servlet implementations. The views have now moved to the
`spring-boot` project and the auto-configuration has been split into
two distinct `@Imports` to save needing full package declarations.
See gh-8941
This commit improves `SpringApplicationAdminMXBeanRegistrar` so that it
work with traditional Servlet-based app but also with Spring WebFlux.
Closes gh-8533
This commit improves the lifecycle of the `NettyWebServer` and allows
multiple restarts when using devtools. Previously, the lifecycle was
tailored for a single start/stop cycle.
Fixes gh-8771