Commit Graph

681 Commits

Author SHA1 Message Date
Simon Baslé 1d890a8952 Make coroutines with custom AOP aspects work with `@Transactional`
Previous to this change, the transactional aspect would supersed the
user-defined AspectJ aspect, shortcircuiting to calling the original
Kotlin suspending function.

This change simplifies the TransactionAspectSupport way of dealing with
transactional coroutines, thanks to the fact that lower level support
for AOP has been introduced in c8169e5c.

Closes gh-33095
2024-07-10 15:35:43 +02:00
Juergen Hoeller 65dbfd09b4 Defensive PersistenceExceptionTranslator bean retrieval on shutdown
Closes gh-33067
2024-06-18 18:31:15 +02:00
Juergen Hoeller 4f02be263f Polishing 2024-05-07 15:52:13 +02:00
Stéphane Nicoll f45e7b9b9b Relax scope of DataIntegrityViolationException
This commit updates the Javadoc of DataIntegrityViolationException to
broaden its scope as it was too specific before.

Closes gh-32631
2024-04-22 14:49:17 +02:00
Juergen Hoeller 0e0397a385 Polishing 2024-04-18 12:18:18 +02:00
Juergen Hoeller 4e20cdeb43 Expand comment on participation in existing transaction
Closes gh-32659
2024-04-18 12:16:33 +02:00
xumengqi 8ec27438e7 Fix transaction definition setTimeout error message since zero is valid
This commit rephrases the `DefaultTransactionDefinition#setTimeout`
exception message to better reflect the fact that 0 is a valid input
value.

Even though this often leads to a transaction immediately timing out
after opening, there is one notable case where this has another
meaningful effect: in Jakarta transactions (`UserTransaction`), when
passing 0 "the transaction service restores the default value".

Closes gh-32635
2024-04-16 16:39:23 +02:00
xumengqi bf3278596c Include actual cause's message in various parsing exception messages
This change improves the message of several parsing-related exceptions
that would previously entirely swallow the original exception's message
and sometimes have a slightly misleading message as a result.

This is done by appending the cause's `toString` representation to the
IllegalArgumentException messages instead of an hardcoded "cause".

Closes gh-32636
2024-04-16 16:25:42 +02:00
Sébastien Deleuze 290a41d398 Refine null-safety in more modules
This commit refines the null-safety in all remaining modules
except spring-test.

See gh-32475
2024-03-26 15:39:18 +01:00
Juergen Hoeller 0955f541cb Polishing 2024-03-06 18:03:36 +01:00
Juergen Hoeller a0ae849856 Polishing 2024-03-05 18:23:13 +01:00
Juergen Hoeller e9110c0729 Polishing 2024-03-04 22:48:52 +01:00
Juergen Hoeller 4dc3eac864 Polishing 2024-02-22 16:56:22 +01:00
Juergen Hoeller 0188270138 Clarify transaction metadata exposed from currentTransactionStatus()
Closes gh-32310
2024-02-22 16:56:17 +01:00
Stéphane Nicoll d4401cc69a Polish 2024-02-01 14:40:02 +01:00
Sam Brannen db535863dd Consistently use class literals for primitive types
To improve consistency and avoid confusion regarding primitive types
and their wrapper types, this commit ensures that we always use class
literals for primitive types.

For example, instead of using the `Void.TYPE` constant, we now
consistently use `void.class`.
2024-01-30 15:26:12 +01:00
Juergen Hoeller 00bda65848 Polishing 2024-01-19 17:09:58 +01:00
Stéphane Nicoll f5b0d9509d Polish 2024-01-17 18:41:15 +01:00
Juergen Hoeller 79cc0ec4aa Make prepareSynchronization overridable again
Closes gh-32000
2024-01-10 13:07:20 +01:00
Stéphane Nicoll 1f2d29ee08 Polish 2024-01-08 17:12:33 +01:00
Juergen Hoeller b4174377c2 Correctly document Propagation.NOT_SUPPORTED in javadoc
See gh-31907
2023-12-31 13:44:09 +01:00
Juergen Hoeller 473efb6d4f Adapt test to current 5.0+ behavior
See gh-24502
2023-12-30 10:47:52 +01:00
Juergen Hoeller a155a6b3e2 Document target method expectations for ReactiveTransactionManager
Closes gh-23277
2023-12-27 23:48:55 +01:00
Juergen Hoeller 75c7596259 Allow Propagation.NOT_SUPPORTED with @TransactionalEventListener
Closes gh-31907
2023-12-26 10:59:19 +01:00
Yanming Zhou afcd03bddc Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
2023-12-06 10:04:56 +01:00
Sam Brannen d71853f105 Polish contribution
See gh-31531
2023-12-04 16:47:25 +01:00
Yanming Zhou 490b5c77fc Use switch expression where feasible 2023-12-04 15:42:55 +01:00
Stéphane Nicoll b2e3be10d4 Add test to reproduce behavior
See gh-24502
2023-11-27 16:31:09 +01:00
Sam Brannen 2d792f000a Polish "Apply SingleSpaceSeparator Checkstyle module"
See gh-31469
2023-10-22 14:18:18 +02:00
Johnny Lim 64e9fcad53 Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations.

Closes gh-31469
2023-10-22 14:09:57 +02:00
Johnny Lim 919faa2ce2 Order modifiers to align with JLS
This commit also applies Checkstyle ModifierOrder to enforce it.

See gh-31368
2023-10-17 16:13:56 +02:00
Stéphane Nicoll 6efc99fdd8 Harmonize BeanRegistrationAotContribution class names 2023-10-17 12:37:52 +02:00
Juergen Hoeller c7b832cfc8 Enforce REQUIRES_NEW for correct transaction configuration
Closes gh-31414
2023-10-11 17:14:32 +02: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 edd1e9134f Polishing 2023-09-20 16:47:05 +02:00
Sam Brannen 5a87f555f8 Update copyright headers 2023-09-08 13:57:41 +02:00
Sam Brannen e42902b742 Stop referring to JDO and outdated JDBC versions in documentation
Closes gh-31183
2023-09-07 13:26:38 +02:00
Philippe Marschall fd18c00e50 Optimize for single TransactionSynchronization
Optimize TransactionSynchronizationManager.getSynchronizations() to
avoid sorting and ArrayList creation in case of a single
TransactionSynchronization.

See gh-27335
2023-08-26 09:52:17 +02:00
Sébastien Deleuze c8169e5cad Add Coroutines support to Spring AOP
This commit adds support for Kotlin Coroutines to Spring AOP
by leveraging CoroutinesUtils#invokeSuspendingFunction in
AopUtils#invokeJoinpointUsingReflection to convert it to the
equivalent Publisher return value, like in other parts of Spring
Framework.

That allows method interceptors with Reactive support to process
related return values.

CglibAopProxy#processReturnType and JdkDynamicAopProxy#invoke
take care of the conversion from the Publisher return value
to Kotlin Coroutines.

Reactive transactional and HTTP service interface support
have been refined to leverage those new generic capabilities.

Closes gh-22462
2023-08-25 11:53:18 +02:00
Johnny Lim 112f755e17 Use IllegalStateException in ReactiveTestTransactionManager.doCommit()
See gh-30107
2023-08-22 17:00:11 +02:00
Sam Brannen f43f1e12f1 Merge branch '6.0.x' 2023-08-17 17:59:30 +02:00
Sam Brannen 9efa99e0d8 Update link to "Method visibility and @Transactional in proxy mode"
See gh-31057
See gh-25582
2023-08-17 17:54:44 +02:00
Juergen Hoeller 45c20e34e4 Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/PropertySourceAnnotationTests.java
2023-08-14 19:29:14 +02:00
Juergen Hoeller 2ce75dc415 Polishing 2023-08-14 19:28:19 +02:00
Juergen Hoeller 86ca6fee16 Merge branch '6.0.x' 2023-08-12 14:52:03 +02:00
Juergen Hoeller 6baa60d454 Polishing 2023-08-12 14:51:02 +02:00
Juergen Hoeller 92410395e3 Remove outdated documentation references to WebLogic/WebSphere
See gh-22093
2023-08-12 14:50:45 +02:00
Juergen Hoeller c65b0a199e Merge branch '6.0.x'
# Conflicts:
#	spring-tx/src/main/java/org/springframework/transaction/event/TransactionalApplicationListenerMethodAdapter.java
2023-08-12 11:35:24 +02:00
Juergen Hoeller d781f299c0 Use extracted attributes instead of annotation access
See gh-31034
2023-08-12 11:34:25 +02:00