Update initialization order in `SpringApplication` to ensure
`setAllowBeanDefinitionOverriding` is called before initializiers.
This prevents an initializer from accidentially overriding a bean.
Closes gh-50264
Update the default implementation of `WritableJson.toByteArray()`
to reduce the amount of garbage created from repeated calls.
Prior to this commit, each call would create a new
`ByteArrayOutputStream` and `OutputStreamWriter` to create the
byte array. Writing structured JSON results in many calls to
the `toByteArray()` method, which means we repeatedly create
and destroy the `ByteArrayOutputStream` and `OutputStreamWriter`
objects. Furthermore, both contain buffers that are often
expanded and will overlap with each other.
The updated implementation uses a custom `Appendable`
implementation that uses a single `ByteBuffer` buffer. It also
has a `ThreadLocal` cache so that repeated calls from the same
thread can reuse the buffer. The cache uses a `SoftReference`
to ensure that the JVM can reclaim space if needed (for example,
if a large JSON line was written).
Closes gh-49428
Add /opt/homebrew/bin as an additional macOS fallback location when
starting external processes.
The previous fallback assumed /usr/local/bin only, which can fail on
Apple Silicon Homebrew setups in restricted PATH environments (for
example, IDE or UI-launched processes).
Update CredentialHelperTests to verify both macOS fallback paths are
attempted.
See gh-49721
Signed-off-by: 1233day <1233day@naver.com>
Update the `Binder` so that empty properties are treated as an indicator
that default value binding should be attempted. This update allow bound
objects to differentiate between a completely missing property vs one
that is present but doesn't have any values.
For example, given the following value object:
@ConfigurationProperties("my")
public record My(Name name, int age) {
public record Name(String first, String last) {
}
}
The following binding scenarios are supported:
1) Full binding
my.name.first=Spring
my.name.last=Boot
my.age=4
Binds to `new My(new Name("Spring", "Boot"), 4)`
(works the same as Spring Boot 4.0)
2) Missing Properties
my.age=4
Binds to `new My(null, 4)`
(works the same as Spring Boot 4.0)
3) Default Properties
my.name=
my.age=4
Binds to `new My(new Name(null, null), 4)`
(previously would throw a converter exception)
Closes gh-48920