Commit Graph

552 Commits

Author SHA1 Message Date
Sam Brannen e5cfbae3fd Polishing 2022-12-16 13:48:45 +01:00
Sam Brannen 618989d317 Update copyright date 2022-12-13 13:44:18 +01:00
Juergen Hoeller 4c69892f39 Detect SQL state 23505/40001 as DuplicateKeyException/CannotAcquireLockException
Favors PessimisticLockingFailureException over plain ConcurrencyFailureException.
Deprecates CannotSerializeTransactionException and DeadlockLoserDataAccessException.

Closes gh-29511
Closes gh-29675
2022-12-13 11:07:13 +01:00
Sam Brannen ad60164911 Update copyright headers for source code changed since August 2022
The changes in this commit were performed using the newly introduced
update_copyright_headers.sh script.
2022-11-29 19:38:42 +01:00
Sam Brannen 36f7597f25 Use AssertJ's hasSize() for collections and maps
Achieved via a global search-and-replace.
2022-11-22 16:50:10 +01:00
Sam Brannen 508d2c7a77 Fix Javadoc formatting issues for headings
Headings in method-level Javadoc must be h4 or higher in recent versions
of Java.
2022-11-16 14:09:42 +01:00
Sam Brannen f26a7dee97 Fix broken tests, update copyright dates, and polish
See gh-29414
2022-11-08 20:07:53 +01:00
Kulwant Singh b2c8546013 Rely on automatic boxing/unboxing in tests
Closes gh-29414
2022-11-08 19:38:03 +01:00
Sam Brannen e1010a179f Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java
2022-11-08 12:27:40 +01:00
Sam Brannen e5878ab15b Fix precondition assertions 2022-11-08 12:08:08 +01:00
Sam Brannen ae368a20b8 Merge branch '5.3.x'
# Conflicts:
#	spring-web/src/test/kotlin/org/springframework/http/codec/json/KotlinSerializationJsonDecoderTests.kt
#	spring-web/src/test/kotlin/org/springframework/http/codec/json/KotlinSerializationJsonEncoderTests.kt
2022-10-08 14:06:41 +02:00
Johnny Lim 1c1a0afbed Use AssertJ static imports consistently in 5.3.x
Closes gh-29282
2022-10-08 13:57:21 +02:00
Sam Brannen 321092ce6f Consistent use of @Deprecated(since = "6.0") 2022-09-20 14:34:24 +02:00
Sam Brannen 8d92c57777 Merge branch '5.3.x'
# Conflicts:
#	spring-tx/src/main/java/org/springframework/jca/cci/core/support/CciDaoSupport.java
2022-09-14 16:52:55 +02:00
Sam Brannen 62a0ab3667 Polish contribution 2022-09-14 16:50:32 +02:00
Marc Wrobel 92a231cf91 Fix typos in Javadoc, reference docs, and code
Closes gh-28822
2022-09-14 16:45:34 +02:00
Sébastien Deleuze 9cfe79186d Stop using RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29059
2022-09-07 10:10:07 +02:00
Sébastien Deleuze b8c1fc9202 Revert "Remove RuntimeHintsUtils"
This reverts commit 3e327f5641.
2022-09-06 18:21:34 +02:00
Sébastien Deleuze 3e327f5641 Remove RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29058
Closes gh-29059
2022-09-06 15:31:02 +02:00
Stephane Nicoll 58b0251af1 Relocate TestGenerationContext to spring-core-test
This commit moves the test implementation for GenerationContext in
spring-core-test. This also removes the copy we had in testfixtures

See gh-28877
2022-09-05 16:21:17 +02:00
Sam Brannen 69f23095b8 Deprecate SynthesizedAnnotation and related methods
Since Spring no longer adds the SynthesizedAnnotation interface to the
JDK dynamic proxy used to synthesize an annotation, this commit
officially deprecates SynthesizedAnnotation and related methods in
RuntimeHintsUtils.

See gh-29041, gh-29054
Closes gh-29053
2022-09-02 12:04:17 +02:00
Phillip Webb 505da5c602 Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode`
shortcuts.

See gh-29011
2022-09-01 17:26:06 -07:00
Sébastien Deleuze daf2d940e4 Remove specific JDK dynamic proxy configuration
Further refinements will be required for
MethodValidationPostProcessor since @Lazy
used by Spring Boot is not supported yet
for that use case.

See gh-28980
2022-08-22 10:53:12 +02:00
Stephane Nicoll d6afa8df2d Improve registration of the same hint for multiple classes
Based on the feedback in #28977 an easy way to create a list of
type references based on a vararg of classes is helpful when
registering the same hints for several types.
2022-08-18 06:52:34 +02:00
Stephane Nicoll 4f0c879778 Rationalize hints required for annotations
This commit updates RuntimeHintsUtils to focus on registering a JDK
proxy only as annotations of annotated elements that have at least
an introspection hints are visible out-of-the-box.

This commit also removes unnecessary hints and adapt `@Reflective` to
detect if a hint is required using the introduced
MergedAnnotation#isSynthesizable.

See gh-28967
2022-08-16 15:42:52 +02:00
Juergen Hoeller 38c9e7f629 Polishing 2022-08-10 23:30:27 +02:00
Stephane Nicoll 2c92d7da8f Harmonize RuntimeHintsRegistrar implementations
Closes gh-28801
2022-07-12 18:30:23 +02:00
Stephane Nicoll 54a3f66d1d Move RuntimeHints predicate support to a dedicated package
This commit moves `RuntimeHintsPredicate` and its support classes that
form a cohesive concept in a dedicated `.predicate` package.

Closes gh-28799
2022-07-12 16:16:12 +02:00
Sam Brannen 49b47cc6cf Merge branch '5.3.x'
# Conflicts:
#	spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java
2022-07-12 12:42:49 +02:00
Marc Wrobel 3b68e97710 Fix and improve Javadoc in spring-tx
Closes gh-28794
2022-07-12 12:36:49 +02:00
Sam Brannen 5178e9c28e Simplify hint registration for Spring AOP proxies
Prior to this commit, when users wished to register proxy hints for a
Spring AOP JDK dynamic proxy, they were required to explicitly specify
SpringProxy, Advised, and DecoratingProxy along with user interfaces.

This commit simplifies hint registration for Spring AOP proxies by
introducing two completeJdkProxyInterfaces() methods in AopProxyUtils,
one that accepts strings and one that accepts classes that represent
the user-specified interfaces implemented the user component to be
proxied. The SpringProxy, Advised, and DecoratingProxy interfaces are
appended to the user-specified interfaces and returned as the complete
set of interfaces that the proxy will implement.

Closes gh-28745
2022-07-10 20:10:12 +02:00
Sam Brannen 2af08cf163 Merge branch '5.3.x'
# Conflicts:
#	spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java
#	spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java
#	spring-test/src/test/java/org/springframework/test/util/MetaAnnotationUtilsTests.java
#	spring-test/src/test/java/org/springframework/test/util/OverriddenMetaAnnotationAttributesTests.java
2022-07-09 16:24:04 +02:00
Sam Brannen d274e893a6 Remove superfluous static declaration for enum, annotation, & interface 2022-07-09 16:16:13 +02:00
Sam Brannen 73d92d66b9 Stop using convention-based annotation attribute overrides in tests
This commit replaces convention-based annotation attribute overrides in
tests with explicit use of @AliasFor -- except for tests in spring-core,
since we still want to test our support for convention-based annotation
attribute overrides.

See gh-28760
2022-07-08 19:28:14 +02:00
Sébastien Deleuze 49fd7c99ae Fix TransactionBeanRegistrationAotProcessorTests
See gh-28717
2022-07-08 17:30:11 +02:00
Sébastien Deleuze 1458d5f39f Add support for @Transactional in native images
This commit introduces a TransactionBeanRegistrationAotProcessor
in charge of creating the required proxy and reflection hints
when @Transactional is detected on beans.

It also refines DefaultAopProxyFactory to throw an exception
when a subclass-based proxy is created in native images
since that's unsupported for now (see gh-28115 related issue).

Closes gh-28717
2022-07-08 16:47:35 +02:00
Sébastien Deleuze 0387d54607 Add support for Transactional in native-image
This commit annotates @Transactional with @Reflective
and registers proxy hints for SpringProxy.

Injection of proxied beans via their interfaces still fails
in native images with a
"No qualifying bean of type MyInterface" error.

See gh-28717
2022-07-07 10:30:34 +02:00
Sébastien Deleuze 50240bb609 Add runtime hints for tx management
Closes gh-28688
2022-07-01 14:54:08 +02:00
Sam Brannen ee209de9cf Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
#	spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2022-05-31 14:15:36 +02:00
Sam Brannen 1beb7068f6 Use new AssertJ exception assertions 2022-05-31 14:08:28 +02:00
Sam Brannen 720261db26 Use List.of() and Set.of() where feasible 2022-05-30 18:42:48 +02:00
Sam Brannen b570f60560 Merge branch '5.3.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedNotification.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedOperationParameter.java
#	spring-core/src/main/java/org/springframework/javapoet/support/package-info.java
#	spring-core/src/main/java/org/springframework/util/TypeUtils.java
#	spring-web/src/main/java/org/springframework/http/HttpMethod.java
2022-03-18 16:47:12 +01:00
Sam Brannen 64b64d9ba0 Stop referring to features as "Java 5" features
With a Java 8 baseline in place for quite some time now, it no longer
makes sense to refer to features such as annotations as "Java 5
annotations".

This commit also removes old `Tiger*Tests` classes, thereby avoiding
duplicate execution of various tests.
2022-03-18 16:32:30 +01:00
Sam Brannen c1033dbfb3 Support type-safe transaction rollback rules
Prior to this commit, there was no way to configure type-safe rollback
rules for transactions.

Even though a rollback rule could be defined using a Class reference
via the `rollbackFor` and `noRollbackFor` attributes in @Transactional,
those Class references got converted to Strings (as the fully qualified
class names of the exception types) in RollbackRuleAttribute which then
applied a pattern-based matching algorithm as if the Class references
had been supplied as Strings/patterns to begin with, thereby losing the
type information.

Pattern-based rollback rules suffer from the following three categories
of unintentional matches.

- identically named exceptions in different packages when the pattern
  does not include the package name -- for example,
  example.client.WebException and example.server.WebException both
  match against a "WebException" pattern.

- similarly named exceptions in the same package when a given exception
  name starts with the name of another exception -- for example,
  example.BusinessException and example.BusinessExceptionWithDetails
  both match against an "example.BusinessException" pattern.

- nested exceptions when an exception type is declared in another
  exception -- for example, example.BusinessException and
  example.BusinessException$NestedException both match against an
  "example.BusinessException" pattern.

This commit prevents the latter two categories of unintentional matches
for rollback rules defined using a Class reference by storing the
exceptionType in RollbackRuleAttribute and using that type in the
implementation of RollbackRuleAttribute.getDepth(Class, int), resulting
in type-safe rollback rules whenever the `rollbackFor` and
`noRollbackFor` attributes in `@Transactional` are used.

Note that the first category of unintentional matches never applied to
rollback rules created from a Class reference since the fully qualified
name of a Class reference always includes the package name.

Closes gh-28098
2022-03-04 19:33:39 +01:00
Sam Brannen 9cb4783296 Merge branch '5.3.x'
# Conflicts:
#	spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java
#	spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java
2022-03-04 16:51:26 +01:00
Sam Brannen fa3130d716 Document that TX rollback rules may result in unintentional matches
Closes gh-28125
2022-03-04 16:39:11 +01:00
Sam Brannen b3e5f86277 Polish rollback rule support 2022-03-03 16:20:13 +01:00
Sam Brannen 68757073b0 Merge branch '5.3.x' 2022-03-02 17:29:26 +01:00
Sam Brannen 340f41af6d Suppress warnings in Gradle build 2022-03-02 17:28:45 +01:00
Sam Brannen 25aa295c2c Rename test class to adhere to conventions 2022-03-02 17:25:37 +01:00