Prior to this commit, `@Order` annotation on `@Bean` method was not
considered for `CommandLineRunner` and `ApplicationRunner`.
This commit introduces a `Runner` marker interface and uses it to
retrieve the runner beans. As a result, it enables the use of `@Order`
annotations on `@Bean` methods for both `CommandLineRunner` and
`ApplicationRunner`.
Signed-off-by: Tadaya Tsuyukubo <tadaya@ttddyy.net>
See gh-37905
Update `JettyServletWebServerFactory` so that the `SimeSiteSupplier`
support is handled using a `Handler` rather than a `HttpStream.Wrapper`.
Closes gh-37809
Add `NestedJarResourceSet` which can be used for nested jar URLs
and unlike the standard Tomcat implementation does not assume that
the JAR is backed by a single file.
Closes gh-37452
There's a window where the deny-all turbo filter has been removed but
Logback has not yet been configured. If any logging that would have
reached an appender is performed in this window, unwanted status
messages will be logged. This window can be closed by ensuring that
the turbo filter is in place while Logback is being configured.
Closes gh-34505
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
This commit adapts to API changes in Spring Framework, see
spring-projects/spring-framework#31117
Previously, the "autowired" executable to use for a bean was always
resolved, even if a custom code fragment didn't really need it. This
is key for binding of immutable configuration properties as we use an
instance supplier for it.
This changes means that the workaround added in maintenance releases
can be removed.
See gh-37337
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
Update `PrivateKeyParser` implementations so that algorithm parameters
for PEM encoded 'EC PRIVATE KEY' files are loaded from the incoming
data.
Prior to this commit, the algorithm parameter was hard-coded to
'secp384r1' which could result in a mismatch to the actual file
content.
Fixes gh-34232
This commit configures the virtual threads support in Reactor Core for
Schedulers if:
* the current JDK is 21 or higher
* the current environment enables this globally with the
`"spring.threads.virtual.enabled"` property.
This needs to happen early in the application startup process, as this
feature is detected statically when the first schedulers call is made.
As a result, this is being done with an environment post processor and
not with an auto-configuration class.
Closes gh-36302
This commit makes sure that sub-namespace that are defined in a flat
manner in a configuration properties are considered for runtime hints
Closes gh-36909
This auto-configures a new SimpleAsyncTaskSchedulerBuilder bean in the
context. This bean is configured to use virtual threads, if enabled.
SimpleAsyncTaskSchedulerCustomizers can be used to customize the built
SimpleAsyncTaskScheduler.
If virtual threads are enabled, the application task scheduler is
configured to be a SimpleAsyncTaskScheduler.
Adds a new configuration property spring.task.scheduling.simple
.concurrency-limit
Closes gh-36609
Before that change, we get 32 random bytes, and then used MD5 on them to
get a hex string. This removes the MD5, we now get 128 bits (output size
of MD5) of random bytes directly.
Previously a schema or data locatio that was a directory would
result in an attempt being made to apply the directory listing as
SQL scripts. This would typically result in a hard to diagnose
failure due to the directory listing not being valid SQL.
This commit updates the initializer to ignore locations for
which the Resources is not readable. This works as Framework's
Resource abstraction does not consider directory resources to be
readable.
Closes gh-36386
- on AtomicBoolean in SpringApplicationBuilder
- on SimpleFormatter
- in a private method in FileSystemWatcher which is always called in a
synchronized block
- Replaced synchronized guarded HashMap with ConcurrentHashMap
- Replace synchronized with Lock when guarding long-running operations
- Remove unnecessary synchronization in FileSystemWatcher
- Replace HashMap with ConcurrentHashMap in Restarter
- Remove unnecessary locking on AtomicBoolean in
SpringApplicationBuilder
- Remove unnecessary locking in SimpleFormatter
Closes gh-36670
The SimpleAsyncTaskExecutorBuilder can be used to create
SimpleAsyncTaskExecutor. It will be auto-configured into the context.
SimpleAsyncTaskExecutorCustomizer can be used to customize the built
SimpleAsyncTaskExecutor.
If virtual threads are enabled:
- SimpleAsyncTaskExecutor will use virtual threads
- SimpleAsyncTaskExecutorBuilder will be used as the application task
executor
A new property 'spring.task.execution.simple.concurrency-limit' has been
added to control the concurrency limit of the SimpleAsyncTaskExecutor
Closes gh-35711
The new ConnectionFactoryDecorator can be used to decorate the
ConnectionFactory built by the ConnectionFactoryBuilder.
The new R2dbcObservationAutoConfiguration configures a
ConnectionFactoryDecorator to attach a ObservationProxyExecutionListener
to ConnectionFactories. This enables Micrometer Observations for R2DBC
queries.
Closes gh-33768
When there is an existing value, deducing the bind method may
incorrectly result in the use of constructor binding. This
results in a failure in the configuration properties
post-processor as it refuses to bind properties to a bean whose
attributes indicate that constructor binding should have been used.
This commit updates ConfigurationPropertiesBean to avoid tryin to
deduce the bind method and instead use the presence or absence of an
existing value to determine the type of binding that should be used.
Only when there is no existing value is constructor binding
appropriate.
Fixes gh-36175
Previously, with the converter beans in a conversion service that
appears after the bean factory's conversion service, they would not
be called for a conversion that could be handled by the
ObjectToObjectConverter in the bean factory's conversion service.
This commit creates a new FormattingConversionService that is empty
except for the converter beans and places it first in the list.
It's followed by the bean factory's conversion service. The shared
application conversion service is added to the end of the list to
pick up any conversions that the previous two services could not
handle. This should maintain backwards compatibility with the
previous arrangement where the converter beans were added to an
application conversion service that went after the bean factory's
conversion service.
Fixes gh-34631