Commit Graph

458 Commits

Author SHA1 Message Date
Juergen Hoeller 1dea55dc20 WebSphereUowTransactionManager sets timeout for actual transaction only
Closes gh-25132
2020-05-26 23:34:36 +02:00
Juergen Hoeller 3c1ee64b7f Explicit nullability declarations for all AOP Alliance methods
Includes consistent declarations in AOP Alliance related Spring AOP code.

Closes gh-24117
2020-05-13 23:33:47 +02:00
Sam Brannen a16d178d72 Polish Javadoc for NameMatchTransactionAttributeSource 2020-05-13 13:29:07 +02:00
Juergen Hoeller dd0d0d51f6 Introduce resolvable timeout attribute on @Transactional and <tx:method>
Placeholders get resolved in timeoutString, qualifier and labels now.

Closes gh-25052
2020-05-12 21:55:22 +02:00
Sam Brannen 715e8c9ef6 Align TransactionManagementConfigurer support in TCF with production
This commit picks up where 613bd3be1d
left off by ensuring that a transaction manager configured via the
TransactionManagementConfigurer API takes precedence over any
transaction manager configured as a bean in the ApplicationContext
unless @Transactional is configured with a qualifier for the explicit
transaction manager to use in tests.

Closes gh-24869
2020-05-11 13:59:34 +02:00
Sam Brannen 65acda8d3e Polishing 2020-05-11 12:26:13 +02:00
Sam Brannen 3f30dcae80 Merge branch '5.2.x' 2020-05-10 15:44:57 +02:00
Yanming Zhou 50a4fdac6e
Use Map::computeIfAbsent to simplify scope implementations
Closes gh-25038
2020-05-10 15:41:00 +02:00
Sam Brannen 2dc9020f80 Merge branch '5.2.x' 2020-05-09 13:57:41 +02:00
Sam Brannen f5d011cb82 Filter reactive tx managers in TransactionAttributeSourceClassFilter
Prior to this commit, the TransactionAttributeSourceClassFilter
filtered out PlatformTransactionManager but not
ReactiveTransactionManager implementations.

TransactionAttributeSourceClassFilter now filters out any
TransactionManager implementation, covering both imperative and
reactive transaction managers.
2020-05-09 13:57:03 +02:00
Sam Brannen 29fe8cecbb Merge branch '5.2.x' 2020-05-08 19:49:56 +02:00
Sam Brannen ec3d647d1d Update spring-tx.xsd regarding reactive tx mgmt support
Closes gh-25030
2020-05-08 19:49:00 +02:00
Sam Brannen 8f7debc769 Merge branch '5.2.x' 2020-05-08 19:26:00 +02:00
Sam Brannen 0f22a5e409 Update Javadoc regarding reactive tx mgmt support
See gh-25030
2020-05-08 19:25:22 +02:00
Mark Paluch 2aa8aef216 Extend transaction attributes with labels
TransactionAttribute now exposes a labels attribute that associates a
descriptive array of labels with a transaction.

Labels may be of a pure descriptive nature or may get evaluated by
transaction managers to associate technology-specific behavior
with the actual transaction.
2020-05-06 16:28:21 +02:00
Sam Brannen 1d0c5195bc Polish Javadoc for TransactionManagementConfigurer 2020-04-06 15:31:48 +02:00
Sam Brannen 144b0e1437 Test status quo for @Primary + TransactionManagementConfigurer
This commit introduces tests for the status quo in production support
for multiple transaction managers registered as @Primary and via the
TransactionManagementConfigurer API.

See gh-24869
2020-04-06 15:16:31 +02:00
Sam Brannen f8ab19dc68 Ensure @EnableTxMgmt tests actually test something 2020-04-06 14:32:34 +02:00
Sam Brannen e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Qimiao Chen 70581d1ea2
Improve javadoc in RollbackRuleAttribute regarding nested classes
Closes gh-24682

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-03-15 12:06:16 +01:00
Juergen Hoeller 193f419520 Deprecate PTM-based constructors in favor of generic TransactionManager
Closes gh-24612
2020-03-11 14:52:03 +01:00
Rossen Stoyanchev adc13f2030 Polishing contribution
See gh-24493
2020-02-20 17:58:47 +00:00
陈其苗 a09f02f64e Minor refactoring in AbstractPlatformTransactionManager
See gh-24493
2020-02-20 17:33:18 +00:00
Juergen Hoeller d1c7083e77 Consistent ROLE_INFRASTRUCTURE declarations for configuration classes
Closes gh-24509
2020-02-12 16:49:02 +01:00
Michael Simons 711fafc924
Improve assertion message in PersistenceExceptionTranslationInterceptor
Closes gh-24484
2020-02-06 15:41:33 +01:00
Sam Brannen 5581f3b77b Use Gradle test fixture support for spring-tx
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 726b1bb1d0 Rename test fixture package in spring-context
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Juergen Hoeller a4f75e9c6a Polishing 2019-12-09 13:29:00 +01:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller 43a86565ca Consider target transaction manager for reactive transaction decision
Closes gh-23832
2019-10-30 16:23:37 +01:00
Mark Paluch 0d8aa854e8 Add tests for cancellation of transactional streams
See gh-23864

Closes gh-23873
2019-10-25 17:16:33 +02:00
Andreas Killaitis f838590300 Commit on cancelled subscription in TransactionalOperator::transactional
Prior to this commit, TransactionalOperator::transactional did not close
the transaction when cancelled.

Closes gh-23864
2019-10-25 14:48:46 +02:00
Sebastien Deleuze b24ac74106 Restore TransactionOperations Kotlin API compatibilty
This commit renames the Runnable variant to executeWithoutResult
and uses a Consumer<TransactionStatus> parameter for better
consistency with TransactionCallbackWithoutResult.

Closes gh-23724
2019-09-29 19:31:12 +02:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sebastien Deleuze 091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Juergen Hoeller a48c13ae73 Avoid deprecated usingWhen method in Reactor 3.3
Closes gh-23562
2019-09-20 21:54:18 +02:00
Mark Paluch 393a81d4a9 Omit cancellation of transactional Monos in TransactionOperator
TransactionOperator.as(Mono) now no longer short-cuts via a Flux.next() but provides an implementation via Mono.usingWhen(…).
The short-cut previously issued a cancellation signal to the transactional Mono causing the transaction cleanup to happen without a handle for synchronization.

Using Mono.usingWhen(…) initiates transaction cleanup when the Mono completes eliminating the need for cancellation of the transactional Publisher.

This change does not fully fix gh-23304 but it softens its impact because TransactionalOperator.transactional(Mono) avoids cancellation.
2019-09-20 20:48:39 +02:00
Sebastien Deleuze fc6480631e Improve Coroutines transaction API
As a follow-up of gh-22915, the purpose of this commit is to improve
Coroutines programmatic transaction API to make it more consistent with
the Java one and more idiomatic.

For suspending functions, this commit changes the
TransactionalOperator.transactional extension with a suspending lambda
parameter to a TransactionalOperator.executeAndAwait one which is
conceptually closer to TransactionalOperator.execute Java API so more
consistent.

For Flow, the TransactionalOperator.transactional extension is correct
but would be more idiomatic as a Flow extension.

This commit also adds code samples to the reference documentation.

Closes gh-23627
2019-09-12 14:45:03 +02:00
康智冬 0d742cf3d0 Fix typos related to indefinite articles for SQL acronym
Closes gh-23603
2019-09-07 16:04:47 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sebastien Deleuze 70bbe71235 Polishing
See gh-22915
2019-09-04 18:24:35 +02:00
Rossen Stoyanchev 57d9b92b94 Upgrade Reactor to Dysprosium RC1
Closes: gh-23579
2019-09-04 08:55:45 +01:00
Juergen Hoeller eb6577755d Stackless variant of NoTransactionException for reactive flows
Closes gh-23360
2019-09-04 00:02:24 +02:00
Sebastien Deleuze 2b4eb610a7 Add support for Coroutines transactions
This commit adds Coroutines extensions for
TransactionalOperator.transactional that accept suspending lambda or
Kotlin Flow parameters.

@Transactional on suspending functions is not supported yet, gh-23575
has been created for that purpose.

Closes gh-22915
2019-09-03 23:41:42 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sam Brannen 3f3e41923f Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
2019-08-17 11:36:58 +02:00
Juergen Hoeller 2c33c11d4c Introduce TransactionOperations.execute(Runnable) convenience method
Closes gh-23250
2019-07-17 22:35:26 +02:00
Sebastien Deleuze a3222476ad Use proxyBeanMethods in ProxyTransactionManagementConfiguration
Closes gh-23166
2019-07-13 12:19:33 +02:00
Stephane Nicoll 9a71a8d357 Fix checkstyle violation
Closes gh-23276
2019-07-12 15:57:16 +02:00
Stephane Nicoll 4f8b347aa0 Do not trigger transactional event listener if no transaction is active
This commit fixes the behaviour of not triggering a transactional event
listener if no transaction is active. Previously, a transaction boundary
was all that was necessary to trigger the listener regardless of the fact
there was an active transaction.

This commit now prevents `Propagation.NOT_SUPPORTED` and
`Propagation.SUPPORTS` without an active transaction to trigger the
listener.

Closes gh-23276
2019-07-12 15:39:14 +02:00
Сергей Цыпанов 1728bf17fc Avoid unnecessary boxing where primitives can be used
Closes gh-23267
2019-07-10 16:51:18 +02:00
Sam Brannen e57845a50f Polishing 2019-07-06 15:32:54 +02:00
Juergen Hoeller 2abff1a5b0 Introduce withoutTransaction factory method on TransactionOperations
Closes gh-23198
2019-07-05 16:24:37 +02:00
Juergen Hoeller 0a77477d32 Merge branch '5.1.x' 2019-06-12 18:16:30 +02:00
Juergen Hoeller fc46abf0b7 Polishing 2019-06-12 18:04:06 +02:00
Juergen Hoeller 42c0d8ec7f Merge branch '5.1.x' 2019-06-12 14:14:40 +02:00
Juergen Hoeller 1ccd99ebe7 Polishing 2019-06-12 14:11:39 +02:00
Sebastien Deleuze 098ac0bbb8 Annotate Object#equals parameter with @Nullable
Closes gh-23093
2019-06-06 14:18:30 +02:00
Sam Brannen 2ed9a61ba0 Rename TransactionSynchronizationManager#currentTransaction()
This commit renames currentTransaction() to forCurrentTransaction() for
greater clarity.

Closes gh-23086
2019-06-05 14:15:07 +03:00
Сергей Цыпанов 6964ed33bf Allocate objects only when it's necessary
Closes gh-23036
2019-05-27 11:14:25 +02:00
Phillip Webb 9d74da006c Migrate JUnit 4 assertions to AssertJ
Migrate all existing JUnit 4 `assert...` based assertions to AssertJ
and add a checkstyle rule to ensure they don't return.

See gh-23022
2019-05-23 15:52:49 -07:00
Phillip Webb 95a9d46a87 Migrate Hamcrest assertions to AssertJ
Migrate all existing `assertThat(..., Matcher)` assertions to AssertJ
and add checkstyle rules to ensure they don't return.

See gh-23022
2019-05-23 15:49:59 -07:00
Juergen Hoeller 3645281c35 Polishing 2019-05-21 19:26:39 +02:00
Juergen Hoeller ff838fd011 Consistently support CompletionStage in ReactiveAdapterRegistry
Aligns ReactiveAdapterRegistry with MVC/messaging handler methods in terms of recognizing CompletionStage as well as CompletableFuture. Includes consistent use of ReactiveAdapter for reactive transactions.

Closes gh-23011
2019-05-21 19:26:12 +02:00
Phillip Webb 02850f357f Migrate exception checking tests to use AssertJ
Migrate tests that use `@Test(expectedException=...)` or
`try...fail...catch` to use AssertJ's `assertThatException`
instead.
2019-05-20 10:47:53 -07:00
Phillip Webb 798b51f4a3 Migrate to BDD Mockito
Migrate all tests to consistently use BDD Mockito. Also add
checksyle rule to enforce going forwards.
2019-05-08 13:46:13 -07:00
Phillip Webb 816bbee8de Remove '.*' imports from tests
Organize test imports to expand all '.*' static imports into
fully qualified imports.

This update will allow us to use additional checkstyle rules in
the future, and will also help if we migrate fully to AssertJ.
2019-05-08 09:55:09 -07:00
Phil Webb d7320de871 Migrate away from ExpectedException (#22922)
* Add limited checkstyles to test code

Add a limited set of checkstyle rules to the test codebase to improve
code consistency.

* Fix checksyle violations in test code

* Organize imports to fix checkstyle for test code

* Migrate to assertThatExceptionOfType

Migrate aware from ExpectedException rules to AssertJ exception
assertions. Also include a checkstyle rules to ensure that the
the ExpectedException is not accidentally used in the future.

See gh-22894
2019-05-08 16:25:52 +02:00
Juergen Hoeller eb16e853b1 Fix JDK 9+ generics compilation problem in TransactionAspectSupport
Includes consistent mentioning of ReactiveTransactionManager in javadoc.

Closes gh-22923
2019-05-08 14:01:12 +02:00
Mark Paluch bb002af8af Fix suspend/resume in AbstractReactiveTransactionManager
We now correctly unwrap suspended resources instead capturing
the Mono emitting suspended resources.

We also properly continue resume by chaining resume Mono's
instead of terminating eagerly.
2019-05-07 15:51:27 +02:00
Sam Brannen ccb01e663a Merge branch '5.1.x' 2019-05-07 13:03:45 +02:00
Sam Brannen 4aaec942c4 Introduce HTTPS mappings in spring.schemas files
Closes gh-22903
2019-05-07 12:56:42 +02:00
Mark Paluch 1d80cbea35 Replace signal materialization in TransactionAspectSupport with usingWhen
We now use Flux.usingWhen() instead materialize/dematerialize operators
to reuse Reactor's resource closure.

Until usingWhen() accepts a BiFunction to consume error signals,
we need to map error signals outside of usingWhen which requires
re-wrapping of the ReactiveTransaction object.

Also, reuse the current TransactionContext to leave Transaction
creation/propagation entirely to ReactiveTransactionManager instead
of creating new TransactionContexts.
2019-05-07 11:23:20 +02:00
Sam Brannen d4379630e2 Use assertThat from Hamcrest instead of JUnit 4
org.junit.Assert.assertThat() is deprecated as of JUnit 4.13.

See gh-22894
2019-05-05 17:31:31 +02:00
Sam Brannen 0aeb7d1e02 Delete dead code in TransactionSynchronizationManager 2019-05-05 17:29:54 +02:00
Sam Brannen 1928167d5d Delete dead code in ReactiveTransactionInterceptorTests 2019-05-05 17:21:15 +02:00
Sam Brannen 7ed4df20a8 Ensure AbstractReactiveTransactionManager compiles in Eclipse IDE 2019-05-05 16:46:11 +02:00
Sam Brannen 3dc38a08c8 Add missing return in AbstractReactiveTransactionManager.processCommit() 2019-05-05 16:30:26 +02:00
Sam Brannen 21864c80d7 Suppress warning 2019-05-05 16:28:45 +02:00
Juergen Hoeller ffbecf1427 Fix Checkstyle violation 2019-05-03 18:24:30 +02:00
Juergen Hoeller f0f6af2926 Merge branch '5.1.x' 2019-05-03 18:13:12 +02:00
Juergen Hoeller 3d6476da46 Polishing 2019-05-03 17:29:22 +02:00
Mark Paluch 83046531da Replace signal materialization in TransactionalOperator with usingWhen
We now use Flux.usingWhen() instead materialize/dematerialize operators
to reuse Reactor's resource closure.

Until usingWhen() accepts a BiFunction to consume error signals,
we need to map error signals outside of usingWhen which requires
re-wrapping of the ReactiveTransaction object.
2019-05-03 16:13:37 +02:00
Mark Paluch 9cff07ce35 Fix doCleanupAfterCompletion invocation
doCleanupAfterCompletion gets now subscribed to when processing
cleanup after a new transaction.
2019-05-03 16:13:37 +02:00
Juergen Hoeller ec8689d1fc Merge branch '5.1.x' 2019-05-03 14:23:59 +02:00
Juergen Hoeller 84266d71e9 Polishing 2019-05-03 14:08:20 +02:00
Juergen Hoeller a2a6bc3d47 Introduce TransactionDefinition.withDefaults() shortcut
Such a static unmodifiable TransactionDefinition with defaults can be used for getTransaction(null) calls, now also possible for getReactiveTransaction. Furthermore, it can be used for a simple TransactionalOperator.create(ReactiveTransactionManager) method without an internal dependency on the transaction.support package.

See gh-22646
2019-05-03 12:28:41 +02:00
Juergen Hoeller ce9162065c Merge branch '5.1.x' 2019-05-02 17:52:12 +02:00
Juergen Hoeller f359c117d3 Polishing 2019-05-02 17:28:32 +02:00
Juergen Hoeller 0be610b0ee Support for reactive transactions in TransactionInterceptor
Introduces TransactionManager marker interface for PlatformTransactionManager as well as ReactiveTransactionManager, allowing for a common configuration type in TransactionAspectSupport and TransactionManagementConfigurer.

Closes gh-22590
2019-05-02 16:23:48 +02:00
Juergen Hoeller 8dabb3e626 Shorter class names for common reactive transaction API types
Introduces TransactionExecution base interface for TransactionStatus as well as ReactiveTransaction. Renames getTransaction method to getReactiveTransaction, allowing for combined implementations of PlatformTransactionManager and ReactiveTransactionManager.

See gh-22646
2019-05-02 16:23:37 +02:00
Juergen Hoeller b5e5e33078 Remove legacy config options from AbstractReactiveTransactionManager
Includes general revision of reactive transaction sources.

See gh-22646
2019-05-02 12:04:25 +02:00
Mark Paluch beea83b9d2 Add reactive transaction support SPI
This commit adds SPI interfaces to support reactive transactions
through spring-tx with optional dependencies to Project Reactor and
supportive implementations for TransactionalOperator and
AbstractReactiveTransactionManager.
2019-05-02 11:59:09 +02:00
Сергей Цыпанов 18af3892dd Make inner classes static where possible
Closes gh-22804
2019-04-17 19:05:24 +02:00
Stephane Nicoll 2cfd2a33c8 Merge branch '5.1.x' 2019-04-17 11:49:51 +02:00