Commit Graph

357 Commits

Author SHA1 Message Date
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
Stephane Nicoll b7415ec92c Polish "Remove PROPAGATION_ prefix in Javadoc"
Closes gh-22809
2019-04-17 11:49:04 +02:00