Commit Graph

3934 Commits

Author SHA1 Message Date
Moritz Halbritter 497bbf9c2d Revise synchronized blocks
- 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
2023-08-03 09:23:46 +02:00
Moritz Halbritter 7c5ec73724 Polish SimpleAsyncTaskExecutorBuilderTests 2023-08-02 10:51:10 +02:00
Scott Frederick 2e50d11d86 Add since attribute to @DeprecatedConfigurationProperty annotation
Closes gh-36482
2023-08-01 16:13:22 -05:00
Stephane Nicoll 191ac10009 Deprecate support for OkHttp
Closes gh-36632
2023-08-01 16:45:13 +02:00
Moritz Halbritter 51008a7d39 Add ThreadPoolTaskSchedulerBuilder and deprecate TaskSchedulerBuilder
Closes gh-36651
2023-08-01 10:32:58 +02:00
Moritz Halbritter e4c38e59a9 Implement SimpleAsyncTaskExecutorBuilder
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
2023-07-31 14:08:00 +02:00
Moritz Halbritter 32c91af440 Add ThreadPoolTaskExecutorBuilder and deprecate TaskExecutorBuilder
Closes gh-36637
2023-07-31 11:51:17 +02:00
Andy Wilkinson f3d623bb1d Merge branch '3.1.x'
Closes gh-36635
2023-07-28 12:22:48 +01:00
Andy Wilkinson 65bc351847 Merge branch '3.0.x' into 3.1.x
Closes gh-36634
2023-07-28 12:22:36 +01:00
Andy Wilkinson 3e99118a48 Merge branch '2.7.x' into 3.0.x
Closes gh-36633
2023-07-28 12:22:21 +01:00
Johnny Lim 5a205dbfd1 Polish
See gh-36620
2023-07-28 11:35:33 +01:00
Andy Wilkinson 0191943be2 Merge branch '3.1.x'
Closes gh-36631
2023-07-28 11:32:12 +01:00
Andy Wilkinson 8f576c36a2 Merge branch '3.0.x' into 3.1.x
Closes gh-36630
2023-07-28 11:31:59 +01:00
Andy Wilkinson 81844c04c4 Merge branch '2.7.x' into 3.0.x
Closes gh-36629
2023-07-28 11:31:49 +01:00
rob-valor 4bbfc5e630 Correct RestTemplateBuilder#defaultHeader javadoc
Replace reactor.netty.http.client.HttpClientRequest with
org.springframework.http.client.ClientHttpRequest

See gh-36614
2023-07-28 11:30:46 +01:00
Yanming Zhou b1ac64c7e2 Harmonize Stream.collect() usage
use Stream.toList() or collect(Collectors.toSet()) where possible.

See gh-36509
2023-07-26 11:15:08 +02:00
Moritz Halbritter c6c8a0f8c8 Merge branch '3.1.x'
Closes gh-36585
2023-07-26 10:25:21 +02:00
Moritz Halbritter 2bc3d22d68 Merge branch '3.0.x' into 3.1.x
Closes gh-36584
2023-07-26 10:24:53 +02:00
Moritz Halbritter c187d96367 Merge branch '2.7.x' into 3.0.x
Closes gh-36583
2023-07-26 10:23:08 +02:00
Francisco Bento 307d6c0a97 Fix Tomcat SSL protocol warn message
See gh-36572
2023-07-26 10:21:43 +02:00
Johnny Lim 96c9915f12 Polish
See gh-36565
2023-07-26 10:00:56 +02:00
Andy Wilkinson b476d368db Polish "Make HikariDataSource participate in checkpoint-restore"
See gh-36422
2023-07-25 17:19:58 +01:00
Moritz Halbritter 6050fff078 Auto-configure observability for R2DBC
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
2023-07-25 17:01:55 +02:00
Stephane Nicoll 771a98b192 Merge branch '3.1.x'
Closes gh-36521
2023-07-24 13:25:10 +02:00
Stephane Nicoll f23cb1fa39 Merge branch '3.0.x' into 3.1.x
Closes gh-36520
2023-07-24 13:25:01 +02:00
Stephane Nicoll 3aeb853c63 Merge branch '2.7.x' into 3.0.x
Closes gh-36519
2023-07-24 13:24:40 +02:00
Stephane Nicoll cc77b8ace1 Polish contribution
See gh-36463
2023-07-24 13:14:01 +02:00
elevne d59cec9e01 Harmonize use of Stream in ConfigDataLocationBindHandler.onSuccess
See gh-36463
2023-07-24 13:06:47 +02:00
Christoph Dreis 343c9c6f7e Remove references to Atomikos and Bitronix
See gh-35562
2023-07-21 16:23:14 +01:00
Andy Wilkinson b5c404f938 Merge branch '3.1.x'
Closes gh-36449
2023-07-19 14:38:44 +01:00
Andy Wilkinson 4d6ee92e21 Merge branch '3.0.x' into 3.1.x
Closes gh-36448
2023-07-19 14:38:28 +01:00
Andy Wilkinson f145ca0c3c Fix reflection hint generation for properties nested in superclass
Fixes gh-36406
2023-07-19 14:37:52 +01:00
Stephane Nicoll 62c9936abf Merge branch '3.1.x'
Closes gh-36428
2023-07-17 15:25:10 +02:00
Stephane Nicoll bb16ed1245 Merge branch '3.0.x' into 3.1.x
Closes gh-36427
2023-07-17 15:24:58 +02:00
Stephane Nicoll 3586bfb629 Merge branch '2.7.x' into 3.0.x
Closes gh-36426
2023-07-17 15:22:43 +02:00
Stephane Nicoll 09e5d38348 Polish "Replace @CsvSource with @ValueSource where feasible"
See gh-36062
2023-07-17 15:16:27 +02:00
Yanming Zhou acb7acd5d9 Replace @CsvSource with @ValueSource where feasible
@ValueSource is more appropriate for single parameter.

See gh-36062
2023-07-17 15:16:26 +02:00
Stephane Nicoll 60df7e3bce Polish contribution
See gh-36251
2023-07-17 13:37:30 +02:00
Bernardo Bulgarelli bc2899c1ef Deprecate DelegatingApplicationContextInitializer and DelegatingApplicationListener
See gh-36251
2023-07-17 13:26:27 +02:00
Stephane Nicoll 783bfb62e2 Merge branch '3.1.x'
Closes gh-36420
2023-07-17 10:04:14 +02:00
Christoph Dreis 8321887d6a Fix typos
See gh-36306
2023-07-17 09:40:16 +02:00
Andy Wilkinson f60547c118 Merge branch '3.1.x'
Closes gh-36360
2023-07-12 12:00:26 +01:00
Andy Wilkinson 218f4f2679 Merge branch '3.0.x' into 3.1.x
Closes gh-36359
2023-07-12 12:00:11 +01:00
Andy Wilkinson 090802b11b Use existing value rather than deducing bind method
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
2023-07-12 11:13:48 +01:00
Andy Wilkinson f4e05c91c7 Use converter beans in preference to ObjectToObjectConverter
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
2023-07-07 08:33:15 +01:00
Spencer Gibb 62674de472
Skip int conversion in ClientHttpRequestFactories
@poutsma added `JdkClientHttpRequestFactory.setReadTimeout(Duration)`
so the conversion to and from int is no longer needed.

See gh-36270
2023-07-06 16:09:31 -07:00
Andy Wilkinson a460f7474f Merge branch '3.1.x'
Closes gh-36269
2023-07-06 19:45:14 +01:00
Andy Wilkinson b7099094b9 Merge branch '3.0.x' into 3.1.x
Closes gh-36268
2023-07-06 19:42:47 +01:00
Andy Wilkinson 4d70b83e80 Improve javadoc of ClientHttpRequestFactories
Closes gh-36267
2023-07-06 19:42:17 +01:00
Andy Wilkinson bb2c4cc742 Polish "Support JDK HttpClient in ClientHttpRequestFactories"
See gh-36118
2023-07-06 17:59:15 +01:00
Arjen Poutsma 3bbfee5e93 Support JDK HttpClient in ClientHttpRequestFactories
See gh-36118
2023-07-06 17:52:36 +01:00
Arjen Poutsma a1a5acf128 Add initial support for RestClient
Introduce initial support for Spring Framework's `RestClient`, in the
form of a `RestClientCustomizer` and `RestClientAutoConfiguration`.

See gh-36213
2023-07-05 21:16:02 +01:00
Andy Wilkinson c3e2c9d684 Polish "Support Jetty in ClientHttpRequestFactories"
See gh-36116
2023-07-04 17:49:07 +01:00
Arjen Poutsma 7ceece3d3d Support Jetty in ClientHttpRequestFactories
This commit introduces support for the JettyClientHttpRequestFactory
in ClientHttpRequestFactories.

See gh-36116
2023-07-04 17:49:07 +01:00
Andy Wilkinson 5a9ca67fba Start building against Spring Framework 6.2.0-M2 snapshots
See gh-36198
2023-07-04 10:20:33 +01:00
Johnny Lim df107890c7 Fix metadata for logging.include-application-name
See gh-36157
2023-07-02 20:10:19 +01:00
Johnny Lim 7c77e1bb85 Polish 'Log correlation IDs when Micrometer tracing is being used'
See gh-36158
2023-07-02 20:08:45 +01:00
Andy Wilkinson 318198ae5d Polish "Change WebServer log messages to use port or ports, not port(s)"
See gh-36103
2023-06-30 19:41:14 +01:00
Ahmed Ashour 298bfd96c2 Change WebServer log messages to use port or ports, not port(s)
See gh-36103
2023-06-30 16:28:21 +01:00
Andy Wilkinson 9d5cc11e16 Merge branch '3.1.x'
Closes gh-36146
2023-06-30 14:47:45 +01:00
Andy Wilkinson ffad1b1dca Merge branch '3.0.x' into 3.1.x
Closes gh-36145
2023-06-30 14:47:34 +01:00
Andy Wilkinson 70406452df Merge branch '2.7.x' into 3.0.x
Closes gh-36144
2023-06-30 14:47:20 +01:00
Andy Wilkinson b06e7e60f9 Polish "Fix asymmetry of equals when element has trailing dashes"
See gh-34804
2023-06-30 14:38:31 +01:00
Eyðun Nielsen a86429a62a Fix asymmetry of equals when element has trailing dashes
See gh-34804
2023-06-30 14:37:47 +01:00
Scott Frederick c22cbb0e2d Merge branch '3.1.x'
Closes gh-36124
2023-06-29 16:55:19 -06:00
Scott Frederick 0a51c466f4 Merge branch '3.0.x' into 3.1.x
Closes gh-36123
2023-06-29 16:54:45 -06:00
Scott Frederick 884489e73a Apply system properties to RestTemplate HttpClient
Fixes gh-35815
2023-06-29 16:31:09 -06:00
Andy Wilkinson 28af839dff Merge branch '3.0.x' into 3.1.x
Closes gh-36097
2023-06-27 20:13:57 +01:00
Andy Wilkinson b3c321e40c Polish javadoc of RestTemplateBuilder.requestFactory(Function)
Closes gh-36046
2023-06-27 20:13:11 +01:00
Andy Wilkinson a1a336ddd8 Merge branch '3.0.x' into 3.1.x
Closes gh-36095
2023-06-27 20:08:39 +01:00
Andy Wilkinson b2bc114d6f Update javadoc to link to non-deprecated ConstructorBinding
Closes gh-36045
2023-06-27 20:08:03 +01:00
Andy Wilkinson dbb24286ff Separate stopping and destruction so web server can be restarted
Previously, when a Servlet-based WebServer was stopped it would also
stop the ServletContext. This led to problems as Tomcat and Undertow
would then not allow a restart. Jetty would allow a restart but
duplicate servlet registrations would then be attempted.

This commit modifies the WebServer lifecycle to separate stopping
and destruction for both servlet and reactive web servers. This
allows a WebServer's stop() implementation to leave some components
running so that they can be restarted. To completely shut down a
WebServer destroy() must now be called.

Both Tomcat and Jetty WebServers have been updated to stop their
network connections when stop() is called but leave other components
running. This works with both servlet and reactive web servers.

Note that an Undertow-based Servlet web server does not support
stop and restart. Once stopped, a Servlet Deployment cannot be
restarted and it does not appear to be possible to separate the
lifecycle of its network connections and a Servlet deployment.

Reactor Netty and Undertow-based reactive web servers can now also
be stopped and then restarted. Calling stop() stops the whole server
but this does not cause a problem as there's no (application-exposed)
ServletContext involved. There may be room to optimize this in the
future if the need arises.

Closes gh-34955
2023-06-26 20:58:59 +01:00
Scott Frederick 493987fc1a Allow key password to be set for a PemSslStoreBundle
Closes gh-35983
2023-06-23 14:40:42 -06:00
Andy Wilkinson b645eb32ac Remove deprecated code that was to be removed in 3.2
Closes gh-36034
2023-06-23 18:14:22 +01:00
Andy Wilkinson 357c67a999 Merge branch '3.1.x' 2023-06-23 15:58:51 +01:00
Andy Wilkinson 3f7fe25cb9 Merge branch '3.0.x' into 3.1.x
Closes gh-36044
2023-06-23 15:58:36 +01:00
Andy Wilkinson 2fae5de245 Merge branch '2.7.x' into 3.0.x
Closes gh-36043
2023-06-23 15:50:02 +01:00
Andy Wilkinson d2966e1cbf Polish "Replace calls to verifyComplete() to avoid indefinite blocking"
See gh-35915
2023-06-23 12:38:12 +01:00
ThomazPassarelli f9da30faf1 Replace calls to verifyComplete() to avoid indefinite blocking
See gh-35915
2023-06-23 12:16:26 +01:00
Moritz Halbritter 8f7fdc507e Polish CorrelationIdFormatter 2023-06-23 08:26:32 +02:00
Phillip Webb 493777d3c9 Include the application name on each log line when it is available
Update Logback and Log4J2 so that they include the application name on
each log line. If `spring.application.name` had not been set, or if
`logging.include-application-name` is `false` then the name is not
logged.

Closes gh-35593
2023-06-22 00:40:51 -07:00
Jonatan Ivanov c1b295fd71 Log correlation IDs when Micrometer tracing is being used
Add support for logging correlation IDs with Logback or Log4J2 whenever
Micrometer tracing is being used.

The `LoggingSystemProperties` class now accepts a defualt value resolver
which will be used whenever a value isn't in the environment. The
`AbstractLoggingSystem` provides a resolver that supports the
`logging.pattern.correlation` property and will return a value whenever
`LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY` is set.

Using `LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY` allows us to
provide a consistent width for the correlation ID, even when it's
missing from the MDC.

The exact correlation pattern returned will depend on the `LoggingSytem`
implementation. Currently Logback and Log4J2 are supported and both
make use of a custom converter which delegates to a new
`CorrelationIdFormatter` class.

Closes gh-33280
2023-06-22 00:28:45 -07:00
Phillip Webb b6120d504a Replace LoggingSystemProperties constants with an Enum
Extract contants from `LoggingSystemProperty` and
`LogbackLoggingSystemProperties` in enum classes.

Closes gh-36015
2023-06-22 00:28:22 -07:00
Phillip Webb 3a796aedea Merge branch '3.1.x' 2023-06-22 00:28:01 -07:00
Phillip Webb 31f218c4e0 Merge branch '3.0.x' into 3.1.x 2023-06-22 00:27:51 -07:00
Phillip Webb 9db3c5a2f7 Polish 2023-06-22 00:24:39 -07:00
Andy Wilkinson 7f5351c7b0 Merge branch '3.1.x' 2023-06-21 19:06:32 +01:00
Andy Wilkinson b770ffc160 Fully prepare connection when using SSL bundle
Fixes gh-36007
2023-06-21 19:05:44 +01:00
Andy Wilkinson 1f9ce508f7 Upgrade to SnakeYAML 2.0
Closes gh-35982
2023-06-19 18:18:31 +01:00
Andy Wilkinson ca5bd37e81 Upgrade to Spring Framework 6.1.0-M1
Closes gh-35977
Closes gh-35980
2023-06-19 18:12:16 +01:00
Andy Wilkinson 1e17d8eeea Upgrade to Liquibase 4.22.0
Closes gh-35956
2023-06-19 16:30:52 +01:00
Phillip Webb 23eb7ec1f8 Merge branch '3.1.x' 2023-06-16 14:35:44 -07:00
Phillip Webb 5d6a507142 Merge branch '3.0.x' into 3.1.x 2023-06-16 14:35:23 -07:00
Phillip Webb 48e13af8c4 Merge branch '2.7.x' into 3.0.x 2023-06-16 14:34:54 -07:00
Phillip Webb b8d2c279ee Update copyright year of changed files 2023-06-16 14:32:43 -07:00
Phillip Webb 13f16da716 Merge branch '3.1.x' 2023-06-16 14:00:12 -07:00
Phillip Webb baddf4c857 Merge branch '3.0.x' into 3.1.x 2023-06-16 13:54:01 -07:00
Phillip Webb 0fd1c89889 Polish 2023-06-16 13:53:33 -07:00
Phillip Webb 691b549e36 Merge branch '2.7.x' into 3.0.x 2023-06-16 10:18:43 -07:00
Phillip Webb f3f8610539 Polish 2023-06-16 10:17:08 -07:00
Stephane Nicoll fe65806582 Merge branch '3.1.x' 2023-06-16 14:32:39 +02:00
Sébastien Deleuze db8dee5aac Refine SpringApplication.Augmented.with Kotlin extension
This commit allows to specify multiple Kotlin classes.

See gh-35784
2023-06-16 14:22:18 +02:00
Andy Wilkinson fb4b26a842 Merge branch '3.1.x' 2023-06-16 10:45:44 +01:00
Andy Wilkinson 1652c27b3c Apply additional sources once when using SpringApplication.from()
Previously, when using SpringApplication.from() any additional
sources configured using with() would be applied to every
SpringApplication that was created within the scope of the call to
run(). This caused problems with Spring Cloud's bootstrap context
where the additional sources would be applied to both the user's
application and to the boostrap context's application.

This commit updates the hook that's used to apply the additional
sources so that it's only applied once. This results in the
additional sources only being added to the first SpringApplication
that is run.

Closes gh-35873
2023-06-16 10:39:20 +01:00
Phillip Webb 0439b630d1 Merge branch '3.1.x'
Closes gh-35923
2023-06-15 14:27:11 -07:00
Phillip Webb c192fb85b2 Merge branch '3.0.x' into 3.1.x
Closes gh-35922
2023-06-15 14:26:55 -07:00
Phillip Webb 4c8b93b37d Merge branch '2.7.x' into 3.0.x
Closes gh-35920
2023-06-15 14:26:36 -07:00
Phillip Webb 137f4ee451 Support reporting of custom Log4J2 log levels from the LoggersEndpoint
Support custom Log4J2 log levels by changing `LoggerConfiguration` so
that it can now report levels using a `LevelConfiguration` object
rather than the limited `LogLevel` enum.

The `Log4J2LoggingSystem` class now uses `LevelConfiguration.ofCustom`
for custom logging levels, rather than throwing an exception.

The `LoggersEndpoint` has also been updated so that it can return the
custom logger name.

Fixes gh-35227
2023-06-15 14:03:22 -07:00
Andy Wilkinson c033484815 Merge branch '3.1.x' 2023-06-15 15:50:34 +01:00
Andy Wilkinson 3d9a308053 Merge branch '3.0.x' into 3.1.x
Closes gh-35913
2023-06-15 15:50:07 +01:00
Andy Wilkinson eeea065595 Merge branch '2.7.x' into 3.0.x
Closes gh-35912
2023-06-15 15:49:36 +01:00
Andy Wilkinson e779fb0bc4 Validate constructor bound config props that implement Validator
Closes gh-33669
2023-06-15 15:29:20 +01:00
Moritz Halbritter 3e4a9f5204 Add property to limit maximum connections for Jetty
Closes gh-35899
2023-06-15 09:42:51 +02:00
Moritz Halbritter fb64f6744e Add 21 to JavaVersion
See gh-35892
2023-06-15 08:30:08 +02:00
Scott Frederick 767ec4e22e Support encrypted PKCS8 private keys in SSL bundles
Properties `ssl.bundle.pem.mybundle.keystore.private-key-password`
and `ssl.bundle.pem.mybundle.truststore.private-key-password` have
been added for configuring the password required to decrypt an
encrypted private key.

Only PKCS8 private keys with encryption are supported. PKCS1 and EC
private keys with encryption are much more complex to decrypt, and
are not supported.

Fixes gh-35652
2023-06-09 11:52:36 -05:00
Moritz Halbritter 49597db77d Merge branch '3.0.x'
Closes gh-35764
2023-06-07 08:28:03 +02:00
Moritz Halbritter 9149fc3e77 Merge branch '2.7.x' into 3.0.x
Closes gh-35763
2023-06-07 08:27:19 +02:00
Moritz Halbritter 2927d50d18 Add JavaVersion.TWENTY
Closes gh-35758
2023-06-07 08:23:05 +02:00
Andy Wilkinson 036b982dd7 Start building against Spring Framework 6.0.10 snapshots
This reverts commit bc63c511 as Framework's previous behavior has
been restored.

See gh-35751
2023-06-06 07:36:37 +01:00
Phillip Webb 1669b81af7 Add 'fromApplication' and 'with' Kotlin extension functions
Update `SpringApplicationExtensions.kt` with `fromApplication` and
`with` functions that make `SpringApplication.from(...)` easier to use
with Kotlin.

Fixes gh-35756
2023-06-05 21:49:41 -07:00
Phillip Webb ff35ed4be1 Merge branch '3.0.x' 2023-06-05 17:18:18 -07:00
Phillip Webb f641ce037d Merge branch '2.7.x' into 3.0.x 2023-06-05 17:17:33 -07:00
Phillip Webb 4eda5bd36f Polish 2023-06-05 17:17:07 -07:00
Andy Wilkinson 22e8a41efa Start building against Spring Framework 6.0.10 snapshots
This reverts commit 9d56b419 as Framework's previous behavior has
been restored.

See gh-35739
2023-06-05 20:02:43 +01:00
Andy Wilkinson f0c40a469b Merge branch '3.0.x'
Closes gh-35654
2023-05-26 18:13:14 +01:00
Andy Wilkinson a58e98af05 Fix binding to constructor bound lateinit properties
Closes gh-35603
2023-05-26 18:12:21 +01:00
Andy Wilkinson 127004b4c5 Merge branch '3.0.x'
Closes gh-35647
2023-05-26 10:29:53 +01:00
Andy Wilkinson 5ad0d49ec1 Fix hints for `@Bean` config props that could be constructor bound
Previously, if a `@ConfigurationProperties`-annotated `@Bean` method
returned a type that looked like it could be constructor bound, the
registered runtime hints were incorrect. With only the bean's class
to work with, the hints registrar would incorrectly determine that
the type would be constructor bound and would not register the hints
required for Java bean binding.

This commit updates the registrar to allow the caller to provide a
Bindable which knows both what should be bound and how it should be
bound, thereby allowing the registrar to generate the correct hints.
The tests for the AOT processor have also been updated to remove
duplication of the tests in BindableRuntimeHintsRegistrarTests and
to focus on the contribution creating Bindable instances with the
bind method that is required to produce the correct reflection hints.

Closes gh-35564

Co-authored-by: Phillip Webb <pwebb@vmware.com>
2023-05-26 10:28:49 +01:00
Andy Wilkinson 1d2a41fd1a Merge branch '3.0.x'
Closes gh-35646
2023-05-26 09:41:55 +01:00
Andy Wilkinson eb60cf4988 Remove duplication of BindableRuntimeHintsRegistrarTests
There were several tests in CPBFIAPT that were duplicating tests in
BindableRuntimeHintsRegistrarTests. To test the AOT processor, all
that is really necessary is to assert that the expected types are
found and passed to BindableRuntimeHintsRegistrar. The tests for
BindableRuntimeHintsRegistrar are then responsible for asserting
that the expected hints are generated for the various different
types.

Closes gh-35645
2023-05-26 09:41:09 +01:00
Andy Wilkinson 75f55cc35a Merge branch '3.0.x'
Closes gh-35644
2023-05-26 09:15:05 +01:00
Andy Wilkinson f03f062770 Move BindMethod to context.properties.bind and expose on Bindable
Closes gh-35642

Co-authored-by: Phillip Webb <pwebb@vmware.com>
2023-05-26 09:13:58 +01:00
Andy Wilkinson 604a1e9538 Merge branch '3.0.x'
Closes gh-35641
2023-05-26 08:51:57 +01:00
Phillip Webb 581a32b107 Polish ConfigurationPropertiesBean
Closes gh-35640
2023-05-26 08:51:21 +01:00
Andy Wilkinson fa49e2b6c6 Merge branch '3.0.x'
Closes gh-35639
2023-05-26 08:42:59 +01:00
Phillip Webb bfbae581d7 Extract BindMethodAttribute class
Create a `BindMethodAttribute` class to manage attribute logic.

Closes gh-35638
2023-05-26 08:33:47 +01:00
Phillip Webb 595fc13b34 Future proof SpringApplication.from(...) by returning a wrapper type
Update `SpringApplication.run` to that it returns a wrapper which
provides access to the `ApplicationContext` rather than the
`ApplicationContext` directly.

This should provide a natural place to add more accessors in the future
should we need to.

Closes gh-35451
2023-05-16 14:04:48 -07:00
Phillip Webb 1ca1145875 Test compatibility with SnakeYAML 1.32 and 1.33 versions
Closes gh-35434
2023-05-15 10:15:51 -07:00
Phillip Webb e3ed87d165 Merge branch '3.0.x' 2023-05-12 13:21:52 -07:00
Phillip Webb 92e420a098 Merge branch '2.7.x' into 3.0.x 2023-05-12 13:14:12 -07:00
Phillip Webb 57e45dfb21 Update copyright year of changed files 2023-05-12 13:01:43 -07:00
Phillip Webb ef4b09718c Fix loading of PKCS#8 PEM encoded EC and DSA keys for buildpack
Polish and port support for PKCS#8 PEM encoded EC and DSA keys to
the buildpack code.

See gh-35322
2023-05-12 13:01:30 -07:00
Moritz Halbritter b70399e998 Merge branch '3.0.x' 2023-05-12 12:03:32 +02:00
Moritz Halbritter 7b4056df7f Merge branch '2.7.x' into 3.0.x 2023-05-12 12:00:11 +02:00
Moritz Halbritter 700e89097c Polish
See https://stackoverflow.com/questions/28671903/the-hashsett-removeall-method-is-surprisingly-slow
2023-05-12 11:57:33 +02:00
Andy Wilkinson 2ca787f78c Merge branch '3.0.x'
Closes gh-35400
2023-05-11 13:47:55 +01:00
Andy Wilkinson acafb907f6 Generate hints for all methods that JavaBeanBinder may call
Fixes gh-35397
2023-05-11 13:34:43 +01:00
Andy Wilkinson c254610e4d Improve testing of BindableRuntimeHintsRegistrar
Closes gh-35398
2023-05-11 13:33:47 +01:00
Andy Wilkinson 88866d7baf Merge branch '3.0.x'
Closes gh-35399
2023-05-11 12:11:29 +01:00
Andy Wilkinson 2d08ba18c1 Improve testing of BindableRuntimeHintsRegistrar
Closes gh-35398
2023-05-11 11:59:34 +01:00
Johnny Lim ff9fd1abeb Polish
See gh-35185
2023-05-10 08:31:36 +02:00
Moritz Halbritter 0f1870ee98 Merge branch '3.0.x'
Closes gh-35367
2023-05-09 14:56:30 +02:00
Moritz Halbritter 077f61bd5d Allow loading of YAML files bigger than 3 MB
Closes gh-34743
2023-05-09 14:56:09 +02:00
Moritz Halbritter 0391860ec3 Merge branch '3.0.x'
Closes gh-35365
2023-05-09 14:38:16 +02:00
Moritz Halbritter 086d654f0b Add support for Ed25519 EC keys
See gh-35364
2023-05-09 14:18:08 +02:00
Moritz Halbritter 69ac9bbe6d Merge branch '2.7.x' into 3.0.x
Closes gh-35364
2023-05-09 14:13:04 +02:00
Moritz Halbritter c238049729 Fix loading of PKCS#8 PEM encoded EC and DSA keys
Closes gh-35322
2023-05-09 13:54:23 +02:00
Stephane Nicoll bc63c511e7 Merge branch '3.0.x' 2023-05-08 15:33:52 +02:00
Stephane Nicoll 9d56b419cd Adapt to change in Spring Framework snapshots
Binding to an HashMap now consistently return a LinkedHashMap.
2023-05-08 15:08:02 +02:00
Moritz Halbritter 441ed30ee4 Polish "Replace Mockito argument captors with assertArg"
Co-authored-by: Andy Wilkinson <wilkinsona@vmware.com>

See gh-35015
2023-05-05 15:41:31 +02:00
Moritz Halbritter cf38c2fd37 Update all keystores with new keys and certificates
See gh-35106
2023-05-05 13:30:22 +02:00
Marc Leroux b61834c92d Replace Mockito argument captors with assertArg
See gh-35015
2023-05-05 11:34:55 +02:00
Moritz Halbritter e356a483b6 Add subject alt to JKS store and re-enable OkHttp SSL tests
Closes gh-35106
2023-05-05 11:17:24 +02:00
Stephane Nicoll e6afc490b0 Expose ApplicationContext when using SpringApplication#from
This commit returns the running application context when running an
application via SpringApplication#from so that it is consistent with
the regular SpringApplication#run.

Closes gh-35203
2023-05-04 17:10:10 +02:00
Moritz Halbritter 5f84588b5d Merge branch '3.0.x'
Closes gh-35270
2023-05-04 13:24:07 +02:00
Moritz Halbritter ea4521acdb Merge branch '2.7.x' into 3.0.x
Closes gh-35269
2023-05-04 13:23:44 +02:00
Moritz Halbritter 6ca9f91a8b Fix NPE when gracefully shutting down netty
Closes gh-35264
2023-05-04 11:54:05 +02:00
Phillip Webb a890323758 Merge branch '3.0.x' 2023-05-02 14:52:42 -07:00
Andy Wilkinson 161b54b1d4 Set Logback's root log level to INFO as early as possible
Closes gh-35238
2023-05-02 18:29:52 +01:00
Scott Frederick 428434c873 Polish SslOptions usage
Change getter methods to return arrays, as this is how most client
library usages need the options.

See gh-34814
2023-04-27 16:37:46 -05:00
Andy Wilkinson 9a0b5e0178 Merge branch '3.0.x'
Closes gh-35173
2023-04-26 12:48:50 +01:00
Andy Wilkinson 7ee1622995 Merge branch '2.7.x' into 3.0.x
Closes gh-35172
2023-04-26 12:48:16 +01:00
Andy Wilkinson 6b9bc012a5 Check that BPP and BFPP bean methods won't cause eager initialization
Closes gh-35164
2023-04-26 11:47:03 +01:00
Phillip Webb b5c9e7c06a Polish SslOptions usage
Add helper method and tighten usage so that exceptions are thrown when
options cannot be applied.

See gh-34814
2023-04-25 22:39:47 -07:00
Stephane Nicoll d55cd3b46f Merge branch '3.0.x'
Closes gh-35160
2023-04-25 11:26:31 +02:00
Stephane Nicoll b286e5a0bb Prevent ServletComponentScan to run again with AOT
Closes gh-34563
2023-04-25 11:20:14 +02:00
Phillip Webb e0b03661d4 Merge branch '3.0.x' 2023-04-24 17:16:52 -07:00
Phillip Webb 8a43710173 Merge branch '2.7.x' into 3.0.x 2023-04-24 17:16:43 -07:00
Phillip Webb a707c5e83e Polish "Fix support for default values in banner placeholders"
Reorder methods and add a test to ensure that getPropertyResolvers
can be mutated.

See gh-34764
2023-04-24 17:15:56 -07:00
Phillip Webb c59c8cc674 Change SslOptions to use null for defaults rather than empty sets
Update `SslOptions` so that `null` is used for default values rather
than empty sets. Most libraries use `null` to indicate defaults so
aligning our class makes things easier.

See gh-34814
2023-04-21 16:18:44 -07:00
Phillip Webb 77c468c956 Add test to check SSL RestTemplate requests work against server
Add a test to `AbstractClientHttpRequestFactoriesTests` to ensure
that SSL configuration works when calling a real Tomcat server.

See gh-34810
2023-04-21 14:06:55 -07:00
Phillip Webb 72c1f667f5 Fix @Since javadoc in RestTemplateBuilder
See gh-34810
2023-04-21 14:06:46 -07:00
Scott Frederick b6befd133c Add SSL bundle support to RestTemplateBuilder auto-configuration
Update RestTemplateBuilder auto-configuration so that an SSL can be
configured via an SSL bundle.

Closes gh-34810
2023-04-21 01:13:10 -07:00
Scott Frederick 66db13b962 Refactor web server support to use SslBundles
Update Tomcat, Jetty, Undertow and Netty servers so that an SslBundle
is used to apply SSL configuration. Existing `Ssl` properties are
internally adapted to an `SslBundle` using the `WebServerSslBundle`
class. Additionally, if `Ssl.getBundle()` returns a non-null value the
the `SslBundles` bean will be used to find a registered bundle by name.

See gh-34814
2023-04-21 01:02:47 -07:00
Scott Frederick e3677f7ff6 Add SSL bundle support to spring-boot module
Add classes to support SSL bundles which can be used to apply SSL
settings in a centralized way. An `SslBundle` can be registered with
an `SslBundleRegistry` and obtained from an `SslBundles` instance. The
`DefaultSslBundleRegistry` provides a default in-memory implementation.

Different client libraries often configure SSL in slightly different
ways. To accommodate this, the `SslBundle` provides a layered approach
of obtaining SSL information:

	- `getStores` provides access to the key store and trust stores
	  as well as any required key store password.

	- `getManagers` provides access to the `KeyManagerFactory`,
	  `TrustManagerFactory` as well as the `KeyManger` and
	  `TrustManager` arrays that they create.

	- `createSslContext` provides a convenient way to obtain a new
	  `SSLContext` instance.

In addition, the `SslBundle` also provides details about the key being
used, the protocol to use and any options that should be applied to the
SSL engine.

See gh-34814
2023-04-21 01:01:11 -07:00
Andy Wilkinson 26c98eded9 Upgrade to Tomcat 10.1.8
Closes gh-35095
2023-04-20 12:22:54 +01:00
Andy Wilkinson b80f4cc985 Upgrade to Tomcat 10.1.8
Closes gh-35089
2023-04-20 09:54:24 +01:00
Andy Wilkinson 28b7c583a9 Ensure shutdown hook is registered when a handler is added
Closes gh-34627
2023-04-18 18:20:14 +01:00
Phillip Webb 7728488541 Allow LogLevel to be used easily with commons logging
Add a `LogLevel.log` method that can be used to log a message at
the given level using commons logging.

Closes gh-35024
2023-04-17 01:00:34 -07:00
Mortitz Halbritter 842e17eced Add Docker Compose support
Add `spring-boot-docker-compose` module with service connection
support.

Closes gh-34747

Co-authored-by: Phillip Webb <pwebb@vmware.com>
Co-authored-by: "Andy Wilkinson <wilkinsona@vmware.com>
2023-04-17 01:00:08 -07:00
Phillip Webb e2262284f1 Add SpringApplication.from(...) support
Add a `SpringApplication.from(...)` method which can be used
to augment an existing application with addition `@Configuration`.

Closes gh-35019
2023-04-17 00:47:59 -07:00
Phillip Webb e9a198a68f Merge branch '3.0.x' 2023-04-12 22:16:35 -07:00
Phillip Webb 7fea4c84b4 Update copyright year of changed files 2023-04-12 22:16:07 -07:00
Stephane Nicoll 0806743966 Merge branch '3.0.x'
Closes gh-34935
2023-04-11 15:46:03 +02:00
Stephane Nicoll 7ee55817b3 Update copyright header of changed file
See gh-34868
2023-04-11 15:39:20 +02:00
kdomo 6728a08219 Use banner location constant
See gh-34868
2023-04-11 15:39:00 +02:00
Stephane Nicoll 6cf08a36da Polish "Add support for additional colors in Log4j2 and Logback"
See gh-34749
2023-04-05 15:00:12 +02:00
Abhijeet Mishra 35994bbd74 Add support for additional colors in Log4j2 and Logback
See gh-34749
2023-04-05 14:49:03 +02:00
Andy Wilkinson cd5d923910 Merge branch '3.0.x'
Closes gh-34793
2023-03-28 10:22:12 +01:00
Andy Wilkinson b2e6db544b Merge branch '2.7.x' into 3.0.x
Closes gh-34792
2023-03-28 10:21:47 +01:00
Andy Wilkinson 2d280bb967 Polish "Fix support for default values in banner placeholders"
See gh-34764
2023-03-28 09:57:22 +01:00
Krzysztof Krason 5c01aa719c Fix support for default values in banner placeholders
See gh-34764
2023-03-28 09:53:52 +01:00
Phillip Webb c0f59a1f61 Merge branch '3.0.x' 2023-03-23 23:04:35 -07:00
Phillip Webb d3cdaf9d01 Merge branch '2.7.x' into 3.0.x 2023-03-23 23:04:01 -07:00
Mortitz Halbritter dcb4f3cf97 Polish 2023-03-23 23:03:46 -07:00
Phillip Webb 3dbc3a1943 Merge branch '3.0.x' 2023-03-23 23:01:32 -07:00
Phillip Webb b6777524f7 Merge branch '2.7.x' into 3.0.x 2023-03-23 23:00:50 -07:00
Mortitz Halbritter bece347987 Polish 2023-03-23 22:59:26 -07:00
Andy Wilkinson f13d6e6862 Revert "Merge pull request #33643 from libetl"
This reverts commit 25e8f2d575, reversing
changes made to e5bc9a2fcb.

Unfortunately, upon additional review we realised that these changes
should not have been accepted. They're a partial implementation of
support for programmatically configuring Logback, implemented in a way
that only works during AOT processing and also potentially makes it
harder for us to implement full support in the future.

Closes gh-34361
2023-03-23 13:39:54 +00:00
Andy Wilkinson 73ee97b095 Upgrade to Logback 1.4.6
This commit includes a change to stop using an API in Logback that
has been deprecated without replacement. As Logback now only supports
.xml configuration files, it would only ever have thrown an
exception. The call to the API has been replaced with thrown an
exception directly.

Closes gh-34686
2023-03-21 12:04:35 +00:00
Andy Wilkinson f6add35f8b Upgrade to Tomcat 10.1.7
Closes gh-34674
2023-03-21 10:07:21 +00:00
Andy Wilkinson 6fdc6fa619 Upgrade to Logback 1.4.6
This commit includes a change to stop using an API in Logback that
has been deprecated without replacement. As Logback now only supports
.xml configuration files, it would only ever have thrown an
exception. The call to the API has been replaced with thrown an
exception directly.

Closes gh-34670
2023-03-21 09:36:31 +00:00
Andy Wilkinson 4be288f672 Upgrade to Tomcat 9.0.73
Closes gh-34655
2023-03-20 21:07:57 +00:00
Phillip Webb 7f5dc1cde5 Merge branch '3.0.x'
Closes gh-34618
2023-03-15 15:10:01 -07:00
Phillip Webb dcb41b03a0 Merge branch '2.7.x' into 3.0.x
Closes gh-34617
2023-03-15 15:09:44 -07:00
Phillip Webb aea57fbd41 Consider the underling file in equals/hashcode
Update `StandardConfigDataResource` so that the underlying file is
considered in equals/hashcode. Prior to this commit, if the classpath
included `.` then the same resource could be loaded twice. Once via
a `ClassPathResource` and once via a `FileSystemResource`.

Fixes gh-34212
2023-03-15 13:52:10 -07:00
Phillip Webb 837ea04cd1 Merge branch '3.0.x'
Closes gh-34611
2023-03-14 18:04:39 -07:00
Phillip Webb 5d21c3616f Don't treat Kotlin data classes as immutable
Unlike records, Kotlin data classes are mutable and so we can't apply
the same constructor detection logic.

Fixes gh-34500
2023-03-14 18:03:15 -07:00
Andy Wilkinson daba3ce52b Upgrade to Tomcat 10.1.7
Closes gh-34582
2023-03-10 19:32:15 +00:00
Andy Wilkinson 656a309ea0 Merge branch '3.0.x'
Closes gh-34516
2023-03-08 17:42:12 +00:00
Andy Wilkinson 3945c48290 Merge branch '2.7.x' into 3.0.x
Closes gh-34515
2023-03-08 17:28:10 +00:00
Andy Wilkinson 86c988d653 Improve compatibility with SnakeYAML 2.0
Closes gh-34405
2023-03-08 17:25:42 +00:00
Scott Frederick 9f0108496c Consolidate web server SSL configuration 2023-03-01 16:54:09 -06:00
Moritz Halbritter 944862389b Merge branch '3.0.x'
Closes gh-34420
2023-03-01 12:51:23 +01:00
Moritz Halbritter 7ea56a2fdb Merge branch '2.7.x' into 3.0.x
Closes gh-34419
2023-03-01 12:51:15 +01:00
1993heqiang 277784b17d Update logger to use GracefulShutdown.class
See gh-34220
2023-03-01 12:50:31 +01:00
Phillip Webb a7f2be8b14 Merge branch '3.0.x'
Closes gh-34411
2023-02-28 14:59:33 -08:00
Phillip Webb 285097d746 Bind nested record types even if they have an existing value
Update logic in `DefaultBindConstructorProvider` introduced in commit
84b13f0748 so that record types are always bound.

Fixes gh-34407
2023-02-28 14:55:43 -08:00
Andy Wilkinson e21c9090b1 Merge branch '3.0.x'
Closes gh-34375
2023-02-24 16:11:40 +00:00
Andy Wilkinson 72de4a8937 Use ResourceLoader's ClassLoader to load ConfigDataLoaders
Fixes gh-34372
2023-02-24 16:10:49 +00:00
Phillip Webb b20b5edf2a Polish 2023-02-23 13:00:30 -08:00
Andy Wilkinson 982e922c0b Fix formatting 2023-02-23 16:58:03 +00:00
Andy Wilkinson 2c0c89454c Upgrade to Log4j2 2.20.0
Closes gh-34349
2023-02-23 16:50:05 +00:00
Phillip Webb 157091a811 Merge branch '3.0.x' 2023-02-22 18:36:57 -08:00
Phillip Webb 0b15962aca Merge branch '2.7.x' into 3.0.x 2023-02-22 18:36:16 -08:00
Phillip Webb c0cf81dbf0 Merge branch '3.0.x' 2023-02-22 12:40:38 -08:00
Phillip Webb 1132b5e8a5 Merge branch '2.7.x' into 3.0.x 2023-02-22 12:40:23 -08:00
Phillip Webb b126c33195 Enable and fix ImportCandidatesTests 2023-02-22 12:39:00 -08:00
Andy Wilkinson 7aba96d132 Merge branch '3.0.x'
Closes gh-34341
2023-02-22 19:49:14 +00:00
Andy Wilkinson 31b1c3e8ad Replace property placeholders in Logback component class names
Closes gh-34336
2023-02-22 19:47:41 +00:00
Phillip Webb eddee5321f Merge branch '3.0.x' 2023-02-22 00:50:29 -08:00
Phillip Webb e04c09ceae Merge branch '2.7.x' into 3.0.x 2023-02-22 00:50:18 -08:00
Phillip Webb 891ce3bd1b Disable recently renamed tests 2023-02-22 00:49:23 -08:00
Phillip Webb 01e8c42c16 Merge branch '2.7.x' into 3.0.x 2023-02-21 23:55:34 -08:00
Phillip Webb bcfb250da2 Merge branch '3.0.x' 2023-02-21 23:52:02 -08:00
Phillip Webb 66016921c6 Merge branch '2.7.x' into 3.0.x 2023-02-21 23:51:52 -08:00
Phillip Webb 3651ba348d Fix checkstyle test violations 2023-02-21 23:49:56 -08:00
Phillip Webb b07269a018 Merge branch '3.0.x' 2023-02-21 23:20:07 -08:00
Phillip Webb c4de86c244 Merge branch '2.7.x' into 3.0.x 2023-02-21 23:17:57 -08:00
Phillip Webb df5898a146 Reformat code following spring-javaformat upgrade 2023-02-21 22:53:27 -08:00
Andy Wilkinson 7aa27e1167 Merge branch '3.0.x'
Closes gh-34320
2023-02-21 16:36:54 +00:00
Andy Wilkinson bc19e398ba Report Logback configuration errors when running in a native image
Closes gh-34315
2023-02-21 16:10:26 +00:00
Andy Wilkinson 0e67fbc855 Merge branch '3.0.x'
Closes gh-34174
2023-02-13 14:50:48 +00:00
Andy Wilkinson a0de59c209 Fix property binding to Kotlin data class in a native image
Fixes gh-34157
2023-02-13 14:49:04 +00:00
Andy Wilkinson b0c376546d Upgrade to MariaDB 3.1.2
Closes gh-34093
2023-02-06 14:46:07 +00:00
Andy Wilkinson f595b46bd3 Upgrade to HttpClient5 5.2.1
Closes gh-34086
2023-02-06 14:46:05 +00:00
Yubao Liu 6ba5329a79 Allow different log level for FILE and CONSOLE appender
- java.util.logging isn't supported yet

See gh-32076
2023-01-31 14:31:51 +01:00
Luka Hartwig 6d05cf3efb Add Nomad to cloud platforms
See gh-32880
2023-01-31 14:11:08 +01:00
lionel benychou 4f17a9cc9d Allow JoranConfigurators to be passed ahead of time in logback
See gh-33643
2023-01-31 11:13:21 +01:00
Moritz Halbritter 23f1c896c9 Merge branch '3.0.x'
Closes gh-34015
2023-01-31 10:20:36 +01:00
Johnny Lim bc7fc90550 Replace Base64Utils with JDK's Base64
See gh-33967
2023-01-31 10:20:06 +01:00
Phillip Webb 390892f11b Merge branch '3.0.x'
Closes gh-33998
2023-01-26 21:45:57 -08:00
Krzysztof Krason f4af93fb03 Use for loop rather than iterator
See gh-33987
2023-01-26 20:47:35 -08:00
Krzysztof Krason 55a50d565c Use Comparator.comparing
See gh-33987
2023-01-26 20:47:34 -08:00
Krzysztof Krason d3efd7e091 Use try with close
See gh-33987
2023-01-26 20:36:38 -08:00
Krzysztof Krason 0e68cae57f Use instanceof patterns
See gh-33987
2023-01-26 20:36:25 -08:00
Krzysztof Krason 6e46423983 Use diamond operators
See gh-33987
2023-01-26 20:35:08 -08:00
Moritz Halbritter a4e7a8bae0 Use bean name for servlet and filter registrations if name is not set
If the name is set, it is used. If not, the bean name is used. If that's
not set, the convention based name is taken.

Registration failures now throw an IllegalStateException instead of
being logged. DynamicRegistrationBean.setIgnoreRegistrationFailure
can be used to restore the old behavior.

See gh-33911
2023-01-24 09:14:06 +01:00
Phillip Webb 0a50b83c75 Add DataSourceBuilderRuntimeHints
Add hints for DataSourceBuilderRuntime.

Closes gh-33692
2023-01-19 10:52:34 -08:00
Moritz Halbritter ae79c60619 Remove instance suppliers in bean definitions
Remove instance suppliers in bean definitions and depend instead
on reflection. This allows the AOT engine to correctly process
the definitions.

Fixes gh-33763
2023-01-18 19:55:56 -08:00
Phillip Webb 71efc55bf9 Merge branch '2.7.x' 2023-01-18 16:31:53 -08:00
Phillip Webb 7c508fa324 Update copyright year of changed files 2023-01-18 15:37:58 -08:00
Moritz Halbritter 94f4a4396c Merge branch '2.7.x'
Closes gh-33880
2023-01-18 17:35:52 +01:00
Moritz Halbritter e8d809fe65 Replace 'via' with 'over' or 'through' in the documentation
Closes gh-33878
2023-01-18 16:56:42 +01:00
Andy Wilkinson a2f593c15f Merge branch '2.7.x'
Closes gh-33876
2023-01-18 14:02:56 +00:00
Andy Wilkinson b5cebed120 Improve failure description when bean def has no resource description
Closes gh-33765
2023-01-18 13:52:56 +00:00
Moritz Halbritter c939e27925 Only set AWT headless property if not already set
Closes gh-28803
2023-01-18 14:28:26 +01:00
Phillip Webb fad88232b9 Update copyright year of changed files 2023-01-17 10:12:38 -08:00
Phillip Webb a889c539ab Merge branch '2.7.x' 2023-01-17 10:12:25 -08:00
Phillip Webb a0fe8241a7 Update copyright year of changed files 2023-01-17 10:07:03 -08:00
Moritz Halbritter 47c1aa2724 Merge branch '2.7.x'
Closes gh-33771
2023-01-12 09:48:21 +01:00
Moritz Halbritter d6f682da7e Polish JavaBeanBinder
Closes gh-33762
2023-01-12 09:45:36 +01:00
Moritz Halbritter e45b47565c Use Threadlocal.remove instead of .set(null)
See https://github.com/spring-cloud/spring-cloud-sleuth/issues/27 for
reference.
2023-01-11 11:38:48 +01:00
Phillip Webb 84b13f0748 Refine constructor detection logic when binding to existing values
Update `DefaultBindConstructorProvider` so that deduced constructors
are not used if there is an existing value.

Prior to this commit, constructor detection logic was not compatible
with earlier versions of Spring Boot. With Spring Boot 3.0.1, given
a class of the following form:

	@ConfigurationProperties(prefix = "example")
	public class ExampleProperties {

	    @NestedConfigurationProperty
	    private final NestedProperty nested = new NestedProperty(
	    		"Default", "default");

	    public NestedProperty getNested() {
	        return nested;
	    }

	}

If `NestedProperty` has a single constructor with arguments, constructor
binding would be used. In Spring Boot 2.x, setter injection would have
been used.

The updated code now only uses constructor injection if an explicit
`@ConstructorBinding` annotation is present, or if there is no existing
value.

Fixes gh-33409
See gh-33710
2023-01-09 16:57:56 -08:00
Phillip Webb a2ac38e203 Update copyright year of changed files 2023-01-09 15:46:07 -08:00
Phillip Webb 80cfcb71ec Update copyright year of changed files 2023-01-09 15:18:10 -08:00
Krzysztof Krason cf6493f65c Simplify AssertJ assertions and also make them more readable
See gh-33653
2023-01-09 11:10:20 +01:00
Kaveh Shamsi 2d95e4a31e Fix JavaDoc typo in LocalServerPort
See gh-33683
2023-01-09 10:27:40 +01:00
Phillip Webb 2e90b71c30 Do not attempt constructor binding for items with an existing value
Update `DefaultBindConstructorProvider` so that it no longer detects
constructors when the `Bindable` has an existing value. This update
allows us change `ConfigurationPropertiesBindingPostProcessor` and
related classes so that all instances created from `@Bean` methods
are treated as `JAVA_BEAN` bindings and will not be accidentally
re-created using constructor binding.

Fixes gh-33710
2023-01-06 17:23:03 -08:00
Phillip Webb f588793445 Update copyright year of changed files 2022-12-22 01:00:42 -08:00
Phillip Webb 0254619782 Merge branch '2.7.x' 2022-12-22 00:59:40 -08:00
Phillip Webb e4772cf3b7 Update copyright year of changed files 2022-12-22 00:59:32 -08:00
Phillip Webb 2e7ca6f82d Warning if <springProfile> is used in phase 2 model elements
Add `SpringProfileIfNestedWithinSecondPhaseElementSanityChecker` which
will provide a warning if `<springProfile>` is used within a phase 2
model element. This is similar to Logback's own `<if>` warnings.

The `LogbackLoggingSystem` has also been updated so that warning are
printed when present.

Fixes gh-33610
2022-12-22 00:57:59 -08:00
Phillip Webb 2ed512ddb5 Use model.deepMarkAsSkipped in SpringProfileModelHandler
Switch `model.markAsSkipped` to `model.deepMarkAsSkipped` in
`SpringProfileModelHandler`.

Although the current call doesn't appear to be causing issues,
it seems best to align our <springProfile> support with the way
that Logback implements its own `<if>` support.

Closes gh-33618
2022-12-22 00:54:06 -08:00
Phillip Webb c257f2b1d2 Merge branch '2.7.x' 2022-12-21 11:37:41 -08:00
Phillip Webb bc6fc33498 Polish 2022-12-21 10:16:25 -08:00
Moritz Halbritter 08659baeba Polish away public modifier on tests 2022-12-16 16:08:44 +01:00
Moritz Halbritter f36e2ecb7b Use AutoClosables with try-with-resources
Closes gh-33538
2022-12-16 15:43:15 +01:00
Moritz Halbritter 725337f976 Make fields final
Closes gh-33537
2022-12-16 14:28:44 +01:00
Moritz Halbritter 47eb3b11b9 Upgrade Tomcat to 10.1.4
Closes gh-33167
Closes gh-33071
2022-12-12 11:19:30 +01:00
Moritz Halbritter a4779b7859 Merge branch '2.7.x'
Closes gh-33433
2022-12-01 13:33:43 +01:00
Moritz Halbritter 16569099ba Polish "Fix bug in webserver start when loading PKCS#11 KeyStore"
See gh-32179
2022-12-01 12:17:34 +01:00
cdanger 716a839d54 Fix bug in webserver start when loading PKCS#11 KeyStore
See gh-32179
2022-12-01 11:53:51 +01:00
Andy Wilkinson 276b288891 Prevent repeat configuration of DB init bean dependencies
Fixes gh-33374
2022-11-30 12:36:24 +00:00
Moritz Halbritter b3878e84ae Fix bug where using a YAML with anchors couldn't be loaded
Closes gh-33404
2022-11-29 11:21:24 +01:00
Andy Wilkinson c1dab0f9e6 Fix AOT processing of add method with array parameter in Logback model
Fixes gh-33387
2022-11-28 14:09:01 +00:00
Andy Wilkinson b9e57c73b5 Consider Kotlin when checking if parameter names are available
See gh-33182
2022-11-17 12:05:16 +00:00
Phillip Webb a50d1f0bd6 Switch to use BeanUtils.getPropertyDescriptors
Update `BindableRuntimeHintsRegistrar` to use
`BeanUtils.getPropertyDescriptors` rather than `BeanInfoFactory`.

Closes gh-33232
2022-11-16 16:28:08 -08:00
Phillip Webb 2e8d766889 Fix BindableRuntimeHintsRegistrarTests inner class to be static 2022-11-16 13:54:34 -08:00
Phillip Webb d6151858f2 Merge pull request #32851 from tumit
* pr/32851:
  Polish 'Add test for BindableRuntimeHintsRegistrar'
  Add tests for BindableRuntimeHintsRegistrar

Closes gh-32851
2022-11-16 13:41:37 -08:00
Phillip Webb 13a4902018 Polish 'Add test for BindableRuntimeHintsRegistrar'
See gh-32851
2022-11-16 13:37:48 -08:00
tumit 7e424bdf0c Add tests for BindableRuntimeHintsRegistrar
See gh-32851
2022-11-16 13:37:31 -08:00
Andy Wilkinson 421f2fac67 Fail fast when constructor bound and not compiled with -parameters
Closes gh-33182
2022-11-16 21:00:55 +00:00
Andy Wilkinson f39b297677 Merge branch '2.7.x'
Closes gh-33227
2022-11-16 18:09:35 +00:00
Andy Wilkinson 04353e4961 Merge branch '2.6.x' into 2.7.x
Closes gh-33226
2022-11-16 16:41:02 +00:00
Stephane Nicoll d9a93a1514 Update copyright year of changed file
See gh-33108
2022-11-16 10:00:50 +01:00
Johnny Lim 6027508cf7 Polish
See gh-33108
2022-11-16 10:00:36 +01:00
Phillip Webb 28dd6b3215 Merge branch '2.7.x'
Closes gh-33212
2022-11-15 19:33:04 -08:00
Phillip Webb e077060a1b Merge branch '2.6.x' into 2.7.x
Closes gh-33211
2022-11-15 19:32:46 -08:00
Phillip Webb 46acb6fb97 Ignore bridge methods when binding java beans
Update `JavaBeanBinder` so that bridge methods are ignored when binding.

Fixes gh-33105
2022-11-15 19:31:06 -08:00
Stephane Nicoll 2baac78175 Only contribute hints for matching methods
Closes gh-33203
2022-11-15 16:56:09 +01:00
Stephane Nicoll fc17171be6 Upgrade to R2DBC Pool 1.0.0.RELEASE
Closes gh-33196
2022-11-15 15:06:21 +01:00
Andy Wilkinson 55b5a32254 Try to stabilize JBoss Logging provider tests
See gh-33155
2022-11-15 07:35:04 +00:00
Andy Wilkinson 6d8a1c90a4 Revert "Upgrade to Tomcat 10.1.2"
This reverts commit 4ccdfc66d6.

See gh-33167
See gh-33071
2022-11-14 20:15:17 +00:00
Andy Wilkinson 45ec107e2f Correct ClassUtils import
See gh-33155
2022-11-14 20:05:35 +00:00
Andy Wilkinson 4ccdfc66d6 Upgrade to Tomcat 10.1.2
Closes gh-33167
Closes gh-33071
2022-11-14 19:46:33 +00:00
Andy Wilkinson b5bdee24c2 When Logback's in use, route JBoss Logging straight into SLF4J
Prior to this change, when using spring-boot-starter-logging, JBoss
Logging would route like this:

JBoss Logging -> Log4j2 API -> SLF4J -> Logback

This is inefficient as there's no need for it to go via the Log4j2
API.

This commit updates the Logback logging system to configure a system
property that controls JBoss's routing. With this change in place,
JBoss Logging will route like this:

JBoss Logging -> SLF4J -> Logback

Closes gh-33155
2022-11-14 18:06:35 +00:00
Andy Wilkinson a2f65cd887 Consider user classes when finding bind constructor
Update `@Autowired` detection logic to consider all constructors and to
search user classes.

Fixes gh-33061

Co-authored-by: Phillip Webb <pwebb@vmware.com>
2022-11-10 11:05:34 -08:00
Andy Wilkinson ac867c3c40 Polish 2022-11-09 19:32:44 +00:00
Andy Wilkinson 7eb0fe4c89 Contribute reflection hints for JsonComponent inner classes
Closes gh-33089
2022-11-09 19:24:15 +00:00
Johnny Lim ea4f22684d Polish Log4j2 changes
See gh-32742
2022-11-08 13:27:01 +00:00
Johnny Lim 6b385a4f79 Fix configLocationsWithConfigurationFileSystemProperty
See gh-32740
2022-11-08 13:17:22 +00:00
Andy Wilkinson beb1e398c9 Polish "Add reflection hints for Tomcat 10.1"
See gh-33064
2022-11-08 09:56:26 +00:00
Sébastien Deleuze 7972224313 Add reflection hints for Tomcat 10.1
In Tomcat 10.0, reflection hints on Http11AprProtocol were
registering hints on AbstractProtocol as a side effect.

Tomcat 10.1 removed this protocol and related hints, breaking
Http11NioProtocol usage in Spring Boot.

This commit contributes reflection hints for protocol properties
accessed reflectively from org.apache.catalina.connector.Connector.

See gh-33064
2022-11-08 09:56:06 +00:00
Phillip Webb 0bdf7e8af7 Allow spring properties to be used in logback <if> blocks
Reorder `SpringBootJoranConfigurator.addModelHandlerAssociations` so
that handlers are added before calling the super method. Prior to this
commit, handlers were added behind filters which prevented them from
being used in `<if>` blocks.

Fixes gh-33028
2022-11-07 14:45:43 -08:00
Andy Wilkinson b67c427259 Upgrade to Servlet 6.0 and related EE 10 specs
Co-authored-by: Phillip Webb <pwebb@vmware.com>

Closes gh-33036
Closes gh-33037
Closes gh-33038
Closes gh-33039
Closes gh-33040
Closes gh-33041
Closes gh-33042
Closes gh-33043
2022-11-07 17:33:38 +00:00
Andy Wilkinson 651f4f7236 Polish "Polish ImportCandidates"
See gh-33013
2022-11-06 11:30:29 +00:00
biergit d7090b500b Polish ImportCandidates
See gh-33013
2022-11-06 11:30:29 +00:00
Phillip Webb 0fa7dba87a Fix formatting
See gh-33013
2022-11-05 19:32:19 -07:00
biergit 8d98ae3435 Polish
See gh-33013
2022-11-05 18:47:37 -07:00
Phillip Webb 34b4ae8e05 Merge branch '2.7.x'
Closes gh-33019
2022-11-05 16:36:55 -07:00
Phillip Webb 2ab1f49442 Merge branch '2.6.x' into 2.7.x
Closes gh-33018
2022-11-05 16:35:26 -07:00
Phillip Webb caf46043c6 Add @DirtiesUrlFactories annotation
Add `@DirtiesUrlFactories` annotation that can be used to reset URL
factories.

Closes gh-33017
2022-11-05 16:30:27 -07:00
Andy Wilkinson 3fce1e9715 Fix reflection hint registration for @JsonMixins
The hints need to be registered for the mixin not the target of the
mixin.

Closes gh-32929
2022-11-03 17:57:27 +00:00
Andy Wilkinson 89af931c29 Update coordinates of jaybird dependency
See gh-32954
2022-11-02 14:59:31 +00:00
Phillip Webb 2b5a29d514 No longer log hostname during application start
Remove hostname logging since `InetAddress.getLocalHost().getHostName()`
causes a network lookup and can take a long time.

Closes gh-32908
2022-10-31 13:46:47 -07:00
Moritz Halbritter 6a138e1753 Polish 2022-10-31 17:03:16 +01:00
Moritz Halbritter 4fef5291bf Fix build
Commit 29f085bd1a690ff7281e00b3a925e1160850ffbb in Spring Framework
automatically registers hints for enclosing directories. This fixes the
tests to use a contains instead of exact match.
2022-10-31 16:59:15 +01:00
Moritz Halbritter 5e034eab59 Revert "Fix build"
This reverts commit ec0d598ba4.
2022-10-31 16:54:06 +01:00
Moritz Halbritter ec0d598ba4 Fix build
Commit 29f085bd1a690ff7281e00b3a925e1160850ffbb in Spring Framework
automatically registers hints for enclosing directories. This fixes the
tests to expect hints for those directories as well.
2022-10-31 13:34:14 +01:00