Commit Graph

25945 Commits

Author SHA1 Message Date
rstoyanchev 3d89acf9ea Adjust checkForLeaks timeout settings
LeakAwareDataBufferFactory#checkForLeaks automatically waits up to 5
sec for buffers to be released, which could be used as a way of
awaiting on some async logic to complete, and as long as buffers are
released, it shouldn't be long. However, the leak test in
LeakAwareDataBufferFactoryTests actually expects to find a leak, and
always ends up waiting the full 5 seconds.

This change, makes the wait configurable, with the no-arg method
using 0 (no waiting). AbstractLeakCheckingTests uses 1 second by
default since ResourceRegionEncoderTests did fail locally. If more
tests need this, we can adjust the settings.
2022-10-24 10:55:39 +01:00
Sébastien Deleuze a1bc539d80 Support multiple @ImportRuntimeHints in the type hierarchy
This commit copies and adapts the logic from
DefaultListableBeanFactory#findMergedAnnotationOnBean
private method to make it suitable for returning multiple
annotations found in the type hierarchy in order
to support this use case with @ImportRuntimeHints.

Closes gh-29361
2022-10-24 10:56:30 +02:00
Brian Clozel 13c0c242b3 Revert "Revisit resource cleanup in ClientHttpRequestFactory"
Closes gh-29370
2022-10-24 10:52:07 +02:00
Brian Clozel 5e808ad018 Merge branch '5.3.x' 2022-10-21 15:24:08 +02:00
Brian Clozel 9410998897 Add caching headers to If-Unmodified-Since responses
Conditional requests using "If-Unmodified-Since" headers are generally
used as precondition checks for state-changing methods (POST, PUT,
DELETE). See https://datatracker.ietf.org/doc/html/rfc7232#section-3.4
The spec also allows for idempotent methods like GET and HEAD.

Prior to this commit, the "If-Unmodified-Since" processing done in
`checkNotModified` (see `ServletWebRequest` and
`DefaultServerWebExchange`) would only focus on the state changing
methods and not take into account the safe methods. For those cases, the
"ETag" and "Last-Modified" would be missing from the response.

This commit ensures that such headers are added as expected in these
cases.

Fixes gh-29362
2022-10-21 15:11:08 +02:00
Sébastien Deleuze 6dd3fb1411 Merge branch '5.3.x' 2022-10-21 09:38:03 +02:00
Mikk Raudvere 12cc8a9f07 Fix typos
Closes gh-29364
2022-10-21 09:35:38 +02:00
Sam Brannen 53f513f90c Suppress deprecation warnings in tests 2022-10-20 16:57:40 +02:00
Brian Clozel fcbd5ec80a Avoid NPEs in DefaultServerRequestObservationConvention
In some cases, the default response status of a `ServerWebExchange` can
be `null`, especially when the response is not available or the server
implementation does not set a default response status.
This commit ensures that the status code is available when deriving
`KeyValue` information from it, or uses a fallback value for the key
value.

Fixes gh-29359
2022-10-20 14:31:41 +02:00
Stephane Nicoll e749cd1ef1 Add constructor introspection hint on Configuration class target
See gh-29358
2022-10-20 12:33:05 +02:00
Brian Clozel 7e0a039291 Add ServerWebExchange getter in WebFlux Observation context
The observation context relies on request and response for propagation,
but the exchange itself holds attributes and locale context so this is
needed for keyvalues extraction in general.

This commit adds a getter to expose the exchange from the context.
2022-10-20 11:13:36 +02:00
Stephane Nicoll 68246dc72c Initiate Ahead of Time chapter
See gh-29350
2022-10-20 10:13:05 +02:00
Juergen Hoeller 5ff5553878 Adapted test for reflection hints on proxied user classes
See gh-29335
2022-10-20 09:35:57 +02:00
Juergen Hoeller f6708d194c Expose all public user class methods (including inherited methods) for reflection
Also removes declared constructors hint for user classes which should not be necessary.

See gh-29335
2022-10-20 09:32:55 +02:00
Phillip Webb f93fda2a95 Guard against no-op observation
Update `ServerHttpObservationFilter` to check if the `Observation`
is a no-op before adding the `ServerRequestObservationContext`.

Prior to this commit, if the `Observation` is a no-op then the
context type added with the `CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE`
would not be a `ServerRequestObservationContext`. This would mean
that `findObservationContext` would throw a `ClassCastException`.

Fixes gh-29356
2022-10-19 16:01:09 -07:00
Sébastien Deleuze 0889e47608 Upgrade to GraalVM 22.3 and introduce PreComputeFieldFeature
This new GraalVM feature replaces ConstantFieldFeature and
introduces various enhancements:
 - Leverage the new FieldValueTransformer API
 - Use GraalVM 22.3 graal-sdk dependency instead of svm one
 - Avoid using internal GraalVM APIs
 - No need to configure JPMS exports
 - Directly integrated in spring-core module
 - Simplified build configuration

Closes gh-29081
Closes gh-29080
Closes gh-29089
2022-10-19 20:35:54 +02:00
Johnny Lim ba99672fd6 Suppress removal warnings
Closes gh-29325
2022-10-19 18:44:59 +02:00
Juergen Hoeller aaa22ad07d Remove square brackets with index/key expressions from generated SQL
See gh-27925
2022-10-19 18:23:49 +02:00
Stephane Nicoll affccba8f1 Simplify AOT contribution for scoped proxies
This commit makes sure that a `ScopedProxyFactoryBean` is exposed in the
container, rather than its underlying proxy. Previously, any lifecycle
method that the proxy target exposed were invoked in the container.

This is a complementary fix to gh-29335
2022-10-19 17:25:35 +02:00
Juergen Hoeller 7f1990e64e Merge branch '5.3.x' 2022-10-19 16:27:03 +02:00
rstoyanchev d4f7484252 Add Builder to RSocketServiceProxyFactory
RSocketServiceProxyFactory now support programmatic initialization
through a builder, while bean-style initialization is deprecated.

Closes gh-29296
2022-10-19 14:36:45 +01:00
Juergen Hoeller 4c38777064 Explain logger name semantics (see AbstractTraceInterceptor.setLoggerName)
See gh-28678
2022-10-19 14:49:27 +02:00
rstoyanchev bd59c7a691 Polishing contribution
Closes gh-29310
2022-10-19 13:22:38 +01:00
Vedran Pavic fb291379e4 Avoid use of Commons Logging in LoggingCacheErrorHandler public API
At present, creating LoggingCacheErrorHandler with custom logger requires use of Commons Logging API, as the appropriate constructor expects org.apache.commons.logging.Log instance. As Commons Logging is rarely the logging framework of choice in applications these days, interaction with its API might not be desirable.

This commit adds LoggingCacheErrorHandler constructor that accepts logger name and thus avoids leaking out any details about the underlying logging framework.
2022-10-19 13:48:59 +02:00
Violeta Georgieva 997d1b3d7e Enable leak detection in Netty 5 tests
See gh-29310
2022-10-19 12:07:40 +01:00
Brian Clozel 57bbc09fca Do not set response status in ServerHttpObservationFilter
Prior to this commit, the `ServerHttpObservationFilter` would set the
response status (and possibly overwrite it) in case an exception is
found as an attribute.
While the exception itself should be used in the observation, the filter
should have no side effect on the response.

Fixes gh-29353
2022-10-19 12:11:00 +02:00
Arjen Poutsma f99c02fc94 Upgrade to Jackson 2.14.0-rc2
This commit upgrades Jackson to 2.14.0-rc2, and uses the new
ByteBufferFeeder in Jackson2Tokenizer.

Unfortunately, because of https://github.com/FasterXML/jackson-core/issues/478,
we had to change the CompilerConventions to suppress class file warnings.

Closes gh-29343
2022-10-19 11:05:40 +02:00
Sébastien Deleuze aa776e40f9 Ensure classpath checks can be evaluated at build-time
Closes gh-29352
2022-10-19 10:49:11 +02:00
Juergen Hoeller 6b6cf1b4a2 Avoid decorated definition bypass for scoped proxy determination
GenericApplicationContext registers proxy hints without any SmartInstantiationAwareBeanPostProcessor involved as well.

Closes gh-29335
2022-10-19 09:55:47 +02:00
Johnny Lim 5dca43ebd6 Use KeyValue.NONE_VALUE where possible
See https://github.com/micrometer-metrics/micrometer/issues/3458

Closes gh-29342
2022-10-19 09:32:57 +02:00
Juergen Hoeller b7ee7975dc Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java
#	spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java
#	spring-r2dbc/src/main/java/org/springframework/r2dbc/core/NamedParameterUtils.java
#	spring-r2dbc/src/test/java/org/springframework/r2dbc/core/NamedParameterUtilsUnitTests.java
2022-10-18 23:11:06 +02:00
Juergen Hoeller 182ba4ac29 Upgrade to Checkstyle 10.3.4 2022-10-18 23:05:10 +02:00
Juergen Hoeller dbcfeb8f4f Aligned with PathMatchingResourcePatternResolverTests on main
See gh-29333
2022-10-18 23:04:44 +02:00
Juergen Hoeller 6f64cfd1e5 Test square brackets with index/key expressions
See gh-27925
2022-10-18 23:04:23 +02:00
Sébastien Deleuze e0129a3631 Register reflection hints for JPA persistence callbacks
Closes gh-29348
2022-10-18 22:52:47 +02:00
Juergen Hoeller d4fac82d68 Preserve square brackets for index/key expressions
Closes gh-27925
2022-10-18 22:39:53 +02:00
Phillip Webb 327eec09ae Allow TestCompiler DynamicClassLoader to resolve '.class' resources
Update `DynamicClassLoader` so that `findResource(...)` also considered
compiled class bytecode.

Closes gh-29347
2022-10-18 11:14:57 -07:00
Juergen Hoeller d17cdf98bb Restore directory matching (explicitly excluding root path itself)
Closes gh-29333
2022-10-18 19:29:29 +02:00
Sébastien Deleuze d89865ad67 Check @RegisterReflectionForBinding specifies at least one class
Closes gh-29346
2022-10-18 19:07:54 +02:00
Sébastien Deleuze 03039fcc00 Refine @RegisterReflectionForBinding Javadoc
Provide a better Javadoc to clarify that @RegisterReflectionForBinding
should annotate a bean and that the types where reflection is needed
should be specified in the annotation attributes.

Closes gh-29345
2022-10-18 19:07:54 +02:00
Juergen Hoeller a3a48a241c Disable array allocation in case of no constructor resolution
Closes gh-28808
2022-10-18 18:59:37 +02:00
Juergen Hoeller 311048726e Upgrade to Derby 10.16
Closes gh-29344
2022-10-18 18:29:15 +02:00
Stephane Nicoll 82a0154bd1 Expose a system property when AOT processing is running
This commit exposes a "spring.aot.processing" system property when the
AOT engine is running. This can be used by code that need to react
differently when the application is being refreshed for AOT processing.

Closes gh-29340
2022-10-18 18:18:43 +02:00
Sam Brannen 004875670b Merge branch '5.3.x'
# Conflicts:
#	spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java
2022-10-18 18:00:44 +02:00
Sam Brannen 652781c4a1 Test status quo in 5.3.x for PathMatchingResourcePatternResolver
See gh-29333
2022-10-18 17:51:29 +02:00
Sam Brannen eadb003a8d Introduce builder API for AOT processor Settings
Closes gh-29341
2022-10-18 16:33:16 +02:00
Juergen Hoeller cb44e09694 Merge branch '5.3.x' 2022-10-18 16:24:35 +02:00
Juergen Hoeller 8e25e32eb8 Polishing 2022-10-18 16:17:30 +02:00
Juergen Hoeller 4b0bf16389 Select ambiguous write method based on read method (matching its return type)
Also avoids unnecessary checks in name-based PropertyDescriptor constructor.

See gh-29320
2022-10-18 16:17:03 +02:00
Stephane Nicoll 6d688e196d Restore support of list of inner bean definitions
This commit restores the support of multiple bean definitions being
specified in a `List` as a property value or constructor argument.

Rather than handling inner bean definitions externally, there are now
supported by BeanDefinitionPropertiesCodeGenerator, and list of such
type is handled transparently.

Closes gh-29075
2022-10-18 15:28:18 +02:00