Browse Source

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.
pull/25045/head
Sam Brannen 5 years ago
parent
commit
f5d011cb82
  1. 8
      spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java

8
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,11 +23,11 @@ import org.springframework.aop.ClassFilter;
import org.springframework.aop.support.StaticMethodMatcherPointcut; import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionManager;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
/** /**
* Inner class that implements a Pointcut that matches if the underlying * Abstract class that implements a Pointcut that matches if the underlying
* {@link TransactionAttributeSource} has an attribute for a given method. * {@link TransactionAttributeSource} has an attribute for a given method.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
@ -87,7 +87,7 @@ abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPoi
@Override @Override
public boolean matches(Class<?> clazz) { public boolean matches(Class<?> clazz) {
if (TransactionalProxy.class.isAssignableFrom(clazz) || if (TransactionalProxy.class.isAssignableFrom(clazz) ||
PlatformTransactionManager.class.isAssignableFrom(clazz) || TransactionManager.class.isAssignableFrom(clazz) ||
PersistenceExceptionTranslator.class.isAssignableFrom(clazz)) { PersistenceExceptionTranslator.class.isAssignableFrom(clazz)) {
return false; return false;
} }

Loading…
Cancel
Save