Commit Graph

28096 Commits

Author SHA1 Message Date
Sam Brannen
d0a088f9dc Clean up warnings in tests 2023-09-23 13:30:05 +02:00
Sam Brannen
ebd4f1b45b Merge branch '6.0.x' 2023-09-23 12:41:19 +02:00
Sam Brannen
08237da4b4 Simplify equals() implementation in PerTargetInstantiationModelPointcut
For equivalence, we only need to compare the preInstantiationPointcut
fields since they include the declaredPointcut fields. In addition, we
should not compare the aspectInstanceFactory fields since
LazySingletonAspectInstanceFactoryDecorator does not implement equals().

See gh-31238
2023-09-23 12:40:28 +02:00
Sam Brannen
bc03088f69 Merge branch '6.0.x' 2023-09-22 18:18:11 +02:00
Sam Brannen
f7496a393d Expand scope of equals() in PerTargetInstantiationModelPointcut
This commit expands the scope of equality checks in the implementation
of equals() for PerTargetInstantiationModelPointcut to include all
fields instead of just the pointcut expression for the declared
pointcut.

See gh-31238
2023-09-22 18:17:07 +02:00
Sam Brannen
64b4a3cf0d Update KeyHolder in JdbcClient when using positional parameters
Prior to this commit, DefaultJdbcClient updated the supplied KeyHolder
when using named parameters but not for positional parameters.

This commit refactors the creation of the
PreparedStatementCreatorFactory so that the PreparedStatementCreator
properly creates a PreparedStatement which returns generated keys.

Closes gh-31297
2023-09-22 17:21:21 +02:00
Sam Brannen
4841e52205 Rename constants in JdbcClientIndexedParameterTests 2023-09-22 16:49:46 +02:00
Brian Clozel
f0686094ff Merge branch '6.0.x' 2023-09-22 11:33:30 +02:00
Brian Clozel
0f92ba1663 Fix typo in ref docs for pattern comparison
Closes gh-31294
2023-09-22 11:32:50 +02:00
Brian Clozel
1e5e8db0e0 Add missing reflection hint in BeanRegistrationsAotContribution
Prior to this commit, the `BeanRegistrationsAotContribution` would only
contribute introspection hints for declared methods. This does not cover
inherited public methods.

This commit adds the missing hint on public methods.

Fixes gh-31293
2023-09-22 10:36:38 +02:00
Brian Clozel
db5ba8562f Upgrade SDKMAN to 17.0.8.1 2023-09-22 09:45:46 +02:00
Brian Clozel
8708a21143 Configure Gradle toolchain auto-provisioning
This commit configures the Foojay resolver plugin in the Gradle build in
order to auto-provision a required JDK distribution if it's not present
already on the host.

Currently the Spring Framework build requires both a JDK 17 and a JDK 21
distribution to build artifacts.

Closes gh-30474
2023-09-22 09:44:12 +02:00
Brian Clozel
0aec9f12ce Upgrade to Gradle Enterprise 3.14 2023-09-22 09:43:44 +02:00
Brian Clozel
d926769a5e Fix copyright headers
See gh-30137
2023-09-22 09:36:38 +02:00
Brian Clozel
1afb6f1861 Upgrade to Java 21 in CI image 2023-09-22 09:02:12 +02:00
rstoyanchev
6b35d43020 Polishing contribution
Closes gh-30113
2023-09-20 18:50:33 +01:00
Andreas Bergander
732f0a6a77 DefaultServletHttpRequestHandler supports DispatcherType.INCLUDE
See gh-30113
2023-09-20 18:50:32 +01:00
rstoyanchev
cc296c5033 Polishing contribution
Closes gh-30137
2023-09-20 18:44:33 +01:00
Joakim Mohn
a1c4fb3840 Lenient URI encoding handling in ForwardedHeaderTransformer
See gh-30137
2023-09-20 18:44:33 +01:00
rstoyanchev
0f7c406a86 Suppress handler mapping logging for introspector
Closes gh-30349
2023-09-20 18:44:33 +01:00
rstoyanchev
2530efd1c7 SseEmitter support for multiline String
Closes gh-30965
2023-09-20 18:44:33 +01:00
Sam Brannen
9350091163 Merge branch '6.0.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java
#	spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java
2023-09-20 17:06:35 +02:00
Sam Brannen
865fa33927 Cache CGLIB proxy classes properly again
The introduction of AdvisedSupport.AdvisorKeyEntry in Spring Framework
6.0.10 resulted in a regression regarding caching of CGLIB generated
proxy classes. Specifically, equality checks for the proxy class cache
became based partially on identity rather than equivalence. For
example, if an ApplicationContext was configured to create a
class-based @Transactional proxy, a second attempt to create the
ApplicationContext resulted in a duplicate proxy class for the same
@Transactional component.

On the JVM this went unnoticed; however, when running Spring
integration tests within a native image, if a test made use of
@⁠DirtiesContext, a second attempt to create the test
ApplicationContext resulted in an exception stating, "CGLIB runtime
enhancement not supported on native image." This is because Test AOT
processing only refreshes a test ApplicationContext once, and the
duplicate CGLIB proxy classes are only requested in subsequent
refreshes of the same ApplicationContext which means that duplicate
proxy classes are not tracked during AOT processing and consequently
not included in a native image.

This commit addresses this regression as follows.

- AdvisedSupport.AdvisorKeyEntry is now based on the toString()
  representations of the ClassFilter and MethodMatcher in the
  corresponding Pointcut instead of the filter's and matcher's
  identities.

- Due to the above changes to AdvisorKeyEntry, ClassFilter and
  MethodMatcher implementations are now required to implement equals(),
  hashCode(), AND toString().

- Consequently, the following now include proper equals(), hashCode(),
  and toString() implementations.

  - CacheOperationSourcePointcut
  - TransactionAttributeSourcePointcut
  - PerTargetInstantiationModelPointcut

Closes gh-31238
2023-09-20 16:56:09 +02:00
Sam Brannen
9120f87897 Consolidate AspectJ test fixtures 2023-09-20 16:47:05 +02:00
Sam Brannen
edd1e9134f Polishing 2023-09-20 16:47:05 +02:00
김희망
6caef9bb3c Refine ServerRequest.queryParamOrNull implementation
Closes gh-31264
2023-09-20 15:51:09 +02:00
Brian Clozel
a97ff39088 Add reflection hint on Publisher for bean destroy support
Prior to this commit, `DisposableBeanAdapter` supported reactive bean
destroy methods by detected if `Publisher` is available on the
classpath. The AOT engine did not contribute a reflection hint for this
call.

This commit ensures that this reflection hint is registered in all
cases, even if there are no destroy methods detected on beans.

Fixes gh-31278
2023-09-20 14:43:12 +02:00
Juergen Hoeller
d46c26d903 Call Lifecycle.stop() for already started beans on failed refresh
Closes gh-20028
2023-09-19 16:45:58 +02:00
Arjen Poutsma
ecd3f191b6 Refactoring external contribution
Created abstract CharSequence decoder, which is extended by
StringDecoder and CharBufferDecoder.

See gh-29741
2023-09-19 16:24:07 +02:00
Markus Heiden
59771318ce Introduce CharBufferDecoder
This commit introduces the CharBufferDecoder.

Closes gh-29741
2023-09-19 16:24:07 +02:00
Brian Clozel
103c6b8bda Add missing reflection hint on Eclipse FileLocator
`PathMatchingResourcePatternResolver` is reflecting on
`org.eclipse.core.runtime.FileLocator` and invoking methods on it for
OSGi support. While this use case is highly unlikely in native images,
registering the reflection entry by itself should be enough.

Fixes gh-31271
2023-09-19 16:06:43 +02:00
Brian Clozel
7af9ce4f03 Add resource hint for spring.properties
Fixes gh-31270
2023-09-19 15:57:59 +02:00
Brian Clozel
4c343ef796 Add missing reflection hints on Kotlin classes
This commit adds the relevant reflection hints required by
`KotlinDetector`; this class is trying to detect both `kotlin.Metadata`
and `kotlin.reflect.full.KClasses`.

Fixes gh- 31269
2023-09-19 15:49:46 +02:00
Brian Clozel
a1f4cdf54e Add missing reflection hint on MonetaryAmount
Fixes gh-31266
2023-09-19 15:48:23 +02:00
Brian Clozel
8074f938b1 Add missing reflection hints on Jakarta types
This commit adds reflection hints for `jakarta.inject.Provider` and
ensures that hints are always contributed even if jakarta classes are
not on the classpath.

Fixes gh-31259
2023-09-19 15:46:13 +02:00
Brian Clozel
e53c2c6331 Reduce nested class lookups in ClassUtils
Prior to this commit, `ClassUtils#forName` would always attempt to
resolve the given class name as a nested type. For example, searching
for `org.example.Spring` would try to resolve:

* `org.example.Spring`
* if not available, try `org.example$Spring` as well

Java classes usually start with uppercase letters, so this additional
lookup can be costly and not very useful.

This commit only attempts nested class lookups when the previous segment
starts with an uppercase. So `org.example.Spring.Issue` will look for
`org.example.Spring$Issue`, but `org.example.Spring` will not.

Closes gh-31258
2023-09-19 15:12:53 +02:00
Stéphane Nicoll
05500373e2 Merge branch '6.0.x' 2023-09-18 17:02:26 +02:00
Stéphane Nicoll
fef3cf8e58 Review AOT-generated code for beanClass and targetType
This commit reviews when an AOT-generated bean definition defines a
beanClass or targetType. Previously, a beanClass was not consistently
set which could lead to issues.

Closes gh-31242
2023-09-18 16:58:01 +02:00
Sébastien Deleuze
4128f4d5c9 Print JVM restoration time in DefaultLifecycleProcessor
Closes gh-31252
2023-09-18 10:57:09 +02:00
Stéphane Nicoll
2fbcff8919 Prevent ValueLoaderEntryProcessor to be created for each get call
Closes gh-31250
2023-09-18 09:27:16 +02:00
Stéphane Nicoll
f79bc7b14d Implement JCacheCache#putIfAbsent as atomic operation
This commit modifies putIfAbsent to use an EntryProcessor that
guarantees that the operation is atomic.

Closes gh-21591
2023-09-18 09:09:47 +02:00
Stéphane Nicoll
57a4628934 Polish log message
See gh-29773
2023-09-18 08:28:10 +02:00
Stéphane Nicoll
6e5c4ef864 Merge pull request #29773 from qpakzk
* pr/29773:
  Log attempt at proxying final methods to WARN instead of INFO

Closes gh-29773
2023-09-18 08:27:12 +02:00
Sangwon Hong
fcbe5fa73f Log attempt at proxying final methods to WARN instead of INFO
See gh-29773
2023-09-18 08:25:37 +02:00
Sam Brannen
7bf520fa8d Make utility methods consistently static in DispatcherServlet
See gh-31244
2023-09-16 18:38:24 +02:00
Sam Brannen
d30ad794ab Update copyright headers
See gh-31245
2023-09-16 18:16:27 +02:00
shin-mallang
3d0f55273c Replace double spaces w/ single spaces in code & comments in spring-webmvc
Except for meaningful double spaces (for example, to align the
indentation of comments), this commit replaces all unnecessary double
spaces with single spaces in the spring-webmvc module.

Closes gh-31245
2023-09-16 18:13:32 +02:00
Sam Brannen
56688ab361 Polish contribution
See gh-31244
2023-09-16 18:09:18 +02:00
shin-mallang
3932f91117 Use List#isEmpty() in DispatcherServlet
This commit uses !isEmpty() instead of size() > 0.

Closes gh-31244
2023-09-16 18:04:30 +02:00
Sam Brannen
293e6ddf85 Polishing 2023-09-16 15:25:16 +02:00