Commit Graph

25537 Commits

Author SHA1 Message Date
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
Sam Brannen
6bdf0bcc4a Introduce ApplicationContextFailureProcessor SPI in the TCF
This commit introduces an ApplicationContextFailureProcessor SPI in the
Spring TestContext Framework that allows third parties to process
failures that occur while a SmartContextLoader attempts to load an
ApplicationContext.

SmartContextLoader implementations must introduce a try-catch block
around the loading code and throw a ContextLoadException that wraps
the failed ApplicationContext and the cause of the failure.

Extensions of AbstractTestContextBootstrapper can configure an
ApplicationContextFailureProcessor by overriding the new protected
getApplicationContextFailureProcessor() method.

DefaultCacheAwareContextLoaderDelegate unwraps any ContextLoadException
and delegates to the configured ApplicationContextFailureProcessor for
processing.

Closes gh-28826
2022-10-18 14:40:35 +02:00
Sam Brannen
19f795a75a Suppress deprecation warnings in tests 2022-10-18 14:31:57 +02:00
Sam Brannen
bfdf070232 Suppress deprecation warnings in tests 2022-10-18 14:21:57 +02:00
Sam Brannen
b2cf2b9d48 Remove unused logger field 2022-10-18 14:19:45 +02:00
Sam Brannen
9dfa46f690 Remove GraalVM workaround in PathMatchingResourcePatternResolver
Tested successfully using the following locally built GraalVM dev build.

OpenJDK Runtime Environment GraalVM 22.3.0-dev (build 17.0.5+5-jvmci-22.3-b07)

Closes gh-29214
2022-10-18 14:18:05 +02:00
Stephane Nicoll
ca5e453f87 Merge pull request #29313 from izeye
* pr/29313:
  Make RestTemplate.createResourceAccessException() private

Closes gh-29313
2022-10-18 13:06:25 +02:00
Johnny Lim
d0a99c15c4 Make RestTemplate.createResourceAccessException() private
See gh-29313
2022-10-18 13:05:25 +02:00
Stephane Nicoll
d19f63fc2b Merge pull request #29326 from izeye
* pr/29326:
  Add missing since on setCurrentlyInvokedFactoryMethod()

Closes gh-29326
2022-10-18 13:03:40 +02:00