Revert nullability changes in reactive transaction support

After further consideration, we have decided to revert the
nullability changes in the reactive TransactionCallback and
TransactionalOperator.

See gh-35561
This commit is contained in:
Sam Brannen 2025-10-02 12:47:37 +02:00
parent 1e83de072c
commit c08610ee58
2 changed files with 4 additions and 6 deletions

View File

@ -16,7 +16,6 @@
package org.springframework.transaction.reactive; package org.springframework.transaction.reactive;
import org.jspecify.annotations.Nullable;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import org.springframework.transaction.ReactiveTransaction; import org.springframework.transaction.ReactiveTransaction;
@ -37,7 +36,7 @@ import org.springframework.transaction.ReactiveTransaction;
* @see TransactionalOperator * @see TransactionalOperator
*/ */
@FunctionalInterface @FunctionalInterface
public interface TransactionCallback<T extends @Nullable Object> { public interface TransactionCallback<T> {
/** /**
* Gets called by {@link TransactionalOperator} within a transactional context. * Gets called by {@link TransactionalOperator} within a transactional context.

View File

@ -16,7 +16,6 @@
package org.springframework.transaction.reactive; package org.springframework.transaction.reactive;
import org.jspecify.annotations.Nullable;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
@ -60,7 +59,7 @@ public interface TransactionalOperator {
* @throws TransactionException in case of initialization, rollback, or system errors * @throws TransactionException in case of initialization, rollback, or system errors
* @throws RuntimeException if thrown by the TransactionCallback * @throws RuntimeException if thrown by the TransactionCallback
*/ */
default <T extends @Nullable Object> Flux<T> transactional(Flux<T> flux) { default <T> Flux<T> transactional(Flux<T> flux) {
return execute(it -> flux); return execute(it -> flux);
} }
@ -71,7 +70,7 @@ public interface TransactionalOperator {
* @throws TransactionException in case of initialization, rollback, or system errors * @throws TransactionException in case of initialization, rollback, or system errors
* @throws RuntimeException if thrown by the TransactionCallback * @throws RuntimeException if thrown by the TransactionCallback
*/ */
default <T extends @Nullable Object> Mono<T> transactional(Mono<T> mono) { default <T> Mono<T> transactional(Mono<T> mono) {
return execute(it -> mono).singleOrEmpty(); return execute(it -> mono).singleOrEmpty();
} }
@ -86,7 +85,7 @@ public interface TransactionalOperator {
* @throws TransactionException in case of initialization, rollback, or system errors * @throws TransactionException in case of initialization, rollback, or system errors
* @throws RuntimeException if thrown by the TransactionCallback * @throws RuntimeException if thrown by the TransactionCallback
*/ */
<T extends @Nullable Object> Flux<T> execute(TransactionCallback<T> action) throws TransactionException; <T> Flux<T> execute(TransactionCallback<T> action) throws TransactionException;
// Static builder methods // Static builder methods