Browse Source

Polishing

pull/31496/head
Sam Brannen 1 year ago
parent
commit
edd1e9134f
  1. 12
      spring-aop/src/main/java/org/springframework/aop/ClassFilter.java
  2. 61
      spring-aop/src/main/java/org/springframework/aop/MethodMatcher.java
  3. 2
      spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java
  4. 42
      spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java
  5. 2
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java
  6. 2
      spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java
  7. 76
      spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java

12
spring-aop/src/main/java/org/springframework/aop/ClassFilter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,11 +17,11 @@ @@ -17,11 +17,11 @@
package org.springframework.aop;
/**
* Filter that restricts matching of a pointcut or introduction to
* a given set of target classes.
* Filter that restricts matching of a pointcut or introduction to a given set
* of target classes.
*
* <p>Can be used as part of a {@link Pointcut} or for the entire
* targeting of an {@link IntroductionAdvisor}.
* <p>Can be used as part of a {@link Pointcut} or for the entire targeting of
* an {@link IntroductionAdvisor}.
*
* <p>Concrete implementations of this interface typically should provide proper
* implementations of {@link Object#equals(Object)} and {@link Object#hashCode()}
@ -44,7 +44,7 @@ public interface ClassFilter { @@ -44,7 +44,7 @@ public interface ClassFilter {
/**
* Canonical instance of a ClassFilter that matches all classes.
* Canonical instance of a {@code ClassFilter} that matches all classes.
*/
ClassFilter TRUE = TrueClassFilter.INSTANCE;

61
spring-aop/src/main/java/org/springframework/aop/MethodMatcher.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,24 +21,25 @@ import java.lang.reflect.Method; @@ -21,24 +21,25 @@ import java.lang.reflect.Method;
/**
* Part of a {@link Pointcut}: Checks whether the target method is eligible for advice.
*
* <p>A MethodMatcher may be evaluated <b>statically</b> or at <b>runtime</b> (dynamically).
* Static matching involves method and (possibly) method attributes. Dynamic matching
* also makes arguments for a particular call available, and any effects of running
* previous advice applying to the joinpoint.
* <p>A {@code MethodMatcher} may be evaluated <b>statically</b> or at <b>runtime</b>
* (dynamically). Static matching involves a method and (possibly) method attributes.
* Dynamic matching also makes arguments for a particular call available, and any
* effects of running previous advice applying to the joinpoint.
*
* <p>If an implementation returns {@code false} from its {@link #isRuntime()}
* method, evaluation can be performed statically, and the result will be the same
* for all invocations of this method, whatever their arguments. This means that
* if the {@link #isRuntime()} method returns {@code false}, the 3-arg
* {@link #matches(java.lang.reflect.Method, Class, Object[])} method will never be invoked.
* {@link #matches(Method, Class, Object[])} method will never be invoked.
*
* <p>If an implementation returns {@code true} from its 2-arg
* {@link #matches(java.lang.reflect.Method, Class)} method and its {@link #isRuntime()} method
* returns {@code true}, the 3-arg {@link #matches(java.lang.reflect.Method, Class, Object[])}
* method will be invoked <i>immediately before each potential execution of the related advice</i>,
* to decide whether the advice should run. All previous advice, such as earlier interceptors
* in an interceptor chain, will have run, so any state changes they have produced in
* parameters or ThreadLocal state will be available at the time of evaluation.
* {@link #matches(Method, Class)} method and its {@link #isRuntime()} method
* returns {@code true}, the 3-arg {@link #matches(Method, Class, Object[])}
* method will be invoked <i>immediately before each potential execution of the
* related advice</i> to decide whether the advice should run. All previous advice,
* such as earlier interceptors in an interceptor chain, will have run, so any
* state changes they have produced in parameters or {@code ThreadLocal} state will
* be available at the time of evaluation.
*
* <p>Concrete implementations of this interface typically should provide proper
* implementations of {@link Object#equals(Object)} and {@link Object#hashCode()}
@ -53,11 +54,10 @@ import java.lang.reflect.Method; @@ -53,11 +54,10 @@ import java.lang.reflect.Method;
public interface MethodMatcher {
/**
* Perform static checking whether the given method matches.
* <p>If this returns {@code false} or if the {@link #isRuntime()}
* method returns {@code false}, no runtime check (i.e. no
* {@link #matches(java.lang.reflect.Method, Class, Object[])} call)
* will be made.
* Perform static checking to determine whether the given method matches.
* <p>If this method returns {@code false} or if {@link #isRuntime()}
* returns {@code false}, no runtime check (i.e. no
* {@link #matches(Method, Class, Object[])} call) will be made.
* @param method the candidate method
* @param targetClass the target class
* @return whether this method matches statically
@ -65,36 +65,35 @@ public interface MethodMatcher { @@ -65,36 +65,35 @@ public interface MethodMatcher {
boolean matches(Method method, Class<?> targetClass);
/**
* Is this MethodMatcher dynamic, that is, must a final call be made on the
* {@link #matches(java.lang.reflect.Method, Class, Object[])} method at
* runtime even if the 2-arg matches method returns {@code true}?
* Is this {@code MethodMatcher} dynamic, that is, must a final check be made
* via the {@link #matches(Method, Class, Object[])} method at runtime even
* if {@link #matches(Method, Class)} returns {@code true}?
* <p>Can be invoked when an AOP proxy is created, and need not be invoked
* again before each method invocation,
* @return whether a runtime match via the 3-arg
* {@link #matches(java.lang.reflect.Method, Class, Object[])} method
* again before each method invocation.
* @return whether a runtime match via {@link #matches(Method, Class, Object[])}
* is required if static matching passed
*/
boolean isRuntime();
/**
* Check whether there a runtime (dynamic) match for this method,
* which must have matched statically.
* <p>This method is invoked only if the 2-arg matches method returns
* {@code true} for the given method and target class, and if the
* {@link #isRuntime()} method returns {@code true}. Invoked
* immediately before potential running of the advice, after any
* Check whether there is a runtime (dynamic) match for this method, which
* must have matched statically.
* <p>This method is invoked only if {@link #matches(Method, Class)} returns
* {@code true} for the given method and target class, and if
* {@link #isRuntime()} returns {@code true}.
* <p>Invoked immediately before potential running of the advice, after any
* advice earlier in the advice chain has run.
* @param method the candidate method
* @param targetClass the target class
* @param args arguments to the method
* @return whether there's a runtime match
* @see MethodMatcher#matches(Method, Class)
* @see #matches(Method, Class)
*/
boolean matches(Method method, Class<?> targetClass, Object... args);
/**
* Canonical instance that matches all methods.
* Canonical instance of a {@code MethodMatcher} that matches all methods.
*/
MethodMatcher TRUE = TrueMethodMatcher.INSTANCE;

2
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java

@ -25,7 +25,7 @@ import org.springframework.lang.Nullable; @@ -25,7 +25,7 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* AspectJPointcutAdvisor that adapts an {@link AbstractAspectJAdvice}
* AspectJ {@link PointcutAdvisor} that adapts an {@link AbstractAspectJAdvice}
* to the {@link org.springframework.aop.PointcutAdvisor} interface.
*
* @author Adrian Colyer

42
spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java

@ -48,7 +48,8 @@ import org.springframework.util.ObjectUtils; @@ -48,7 +48,8 @@ import org.springframework.util.ObjectUtils;
/**
* Base class for AOP proxy configuration managers.
* These are not themselves AOP proxies, but subclasses of this class are
*
* <p>These are not themselves AOP proxies, but subclasses of this class are
* normally factories from which AOP proxy instances are obtained directly.
*
* <p>This class frees subclasses of the housekeeping of Advices
@ -56,7 +57,8 @@ import org.springframework.util.ObjectUtils; @@ -56,7 +57,8 @@ import org.springframework.util.ObjectUtils;
* methods, which are provided by subclasses.
*
* <p>This class is serializable; subclasses need not be.
* This class is used to hold snapshots of proxies.
*
* <p>This class is used to hold snapshots of proxies.
*
* @author Rod Johnson
* @author Juergen Hoeller
@ -111,7 +113,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -111,7 +113,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
}
/**
* Create a AdvisedSupport instance with the given parameters.
* Create an {@code AdvisedSupport} instance with the given parameters.
* @param interfaces the proxied interfaces
*/
public AdvisedSupport(Class<?>... interfaces) {
@ -131,7 +133,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -131,7 +133,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
/**
* Set the given object as target.
* Will create a SingletonTargetSource for the object.
* <p>Will create a SingletonTargetSource for the object.
* @see #setTargetSource
* @see org.springframework.aop.target.SingletonTargetSource
*/
@ -506,9 +508,9 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -506,9 +508,9 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
}
/**
* Copy the AOP configuration from the given AdvisedSupport object,
* but allow substitution of a fresh TargetSource and a given interceptor chain.
* @param other the AdvisedSupport object to take proxy configuration from
* Copy the AOP configuration from the given {@link AdvisedSupport} object,
* but allow substitution of a fresh {@link TargetSource} and a given interceptor chain.
* @param other the {@code AdvisedSupport} object to take proxy configuration from
* @param targetSource the new TargetSource
* @param advisors the Advisors for the chain
*/
@ -528,8 +530,8 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -528,8 +530,8 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
}
/**
* Build a configuration-only copy of this AdvisedSupport,
* replacing the TargetSource.
* Build a configuration-only copy of this {@link AdvisedSupport},
* replacing the {@link TargetSource}.
*/
AdvisedSupport getConfigurationOnlyCopy() {
AdvisedSupport copy = new AdvisedSupport(this.advisorChainFactory, this.methodCache);
@ -604,8 +606,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -604,8 +606,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof MethodCacheKey methodCacheKey &&
this.method == methodCacheKey.method));
return (this == other || (other instanceof MethodCacheKey that && this.method == that.method));
}
@Override
@ -630,7 +631,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -630,7 +631,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
/**
* Stub for an Advisor instance that is just needed for key purposes,
* Stub for an {@link Advisor} instance that is just needed for key purposes,
* allowing for efficient equals and hashCode comparisons against the
* advice class and the pointcut.
* @since 6.0.10
@ -642,10 +643,11 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -642,10 +643,11 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
private final Class<?> adviceType;
@Nullable
private String classFilterKey;
private final String classFilterKey;
@Nullable
private String methodMatcherKey;
private final String methodMatcherKey;
public AdvisorKeyEntry(Advisor advisor) {
this.adviceType = advisor.getAdvice().getClass();
@ -654,6 +656,10 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -654,6 +656,10 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
this.classFilterKey = ObjectUtils.identityToString(pointcut.getClassFilter());
this.methodMatcherKey = ObjectUtils.identityToString(pointcut.getMethodMatcher());
}
else {
this.classFilterKey = null;
this.methodMatcherKey = null;
}
}
@Override
@ -663,10 +669,10 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -663,10 +669,10 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof AdvisorKeyEntry otherEntry &&
this.adviceType == otherEntry.adviceType &&
ObjectUtils.nullSafeEquals(this.classFilterKey, otherEntry.classFilterKey) &&
ObjectUtils.nullSafeEquals(this.methodMatcherKey, otherEntry.methodMatcherKey)));
return (this == other || (other instanceof AdvisorKeyEntry that &&
this.adviceType == that.adviceType &&
ObjectUtils.nullSafeEquals(this.classFilterKey, that.classFilterKey) &&
ObjectUtils.nullSafeEquals(this.methodMatcherKey, that.methodMatcherKey)));
}
@Override

2
spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java vendored

@ -27,7 +27,7 @@ import org.springframework.util.CollectionUtils; @@ -27,7 +27,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
/**
* A Pointcut that matches if the underlying {@link CacheOperationSource}
* A {@code Pointcut} that matches if the underlying {@link CacheOperationSource}
* has an attribute for a given method.
*
* @author Costin Leau

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

@ -27,7 +27,7 @@ import org.springframework.transaction.TransactionManager; @@ -27,7 +27,7 @@ import org.springframework.transaction.TransactionManager;
import org.springframework.util.ObjectUtils;
/**
* Abstract class that implements a Pointcut that matches if the underlying
* Abstract class that implements a {@code Pointcut} that matches if the underlying
* {@link TransactionAttributeSource} has an attribute for a given method.
*
* @author Juergen Hoeller

76
spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionInterceptorTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Juergen Hoeller
* @author Mark Paluch
*/
public class AnnotationTransactionInterceptorTests {
class AnnotationTransactionInterceptorTests {
private final CallCountingTransactionManager ptm = new CallCountingTransactionManager();
@ -53,7 +53,7 @@ public class AnnotationTransactionInterceptorTests { @@ -53,7 +53,7 @@ public class AnnotationTransactionInterceptorTests {
@Test
public void classLevelOnly() {
void classLevelOnly() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestClassLevelOnly());
proxyFactory.addAdvice(this.ti);
@ -74,7 +74,7 @@ public class AnnotationTransactionInterceptorTests { @@ -74,7 +74,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withSingleMethodOverride() {
void withSingleMethodOverride() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithSingleMethodOverride());
proxyFactory.addAdvice(this.ti);
@ -95,7 +95,7 @@ public class AnnotationTransactionInterceptorTests { @@ -95,7 +95,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withSingleMethodOverrideInverted() {
void withSingleMethodOverrideInverted() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithSingleMethodOverrideInverted());
proxyFactory.addAdvice(this.ti);
@ -116,7 +116,7 @@ public class AnnotationTransactionInterceptorTests { @@ -116,7 +116,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withMultiMethodOverride() {
void withMultiMethodOverride() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithMultiMethodOverride());
proxyFactory.addAdvice(this.ti);
@ -137,7 +137,7 @@ public class AnnotationTransactionInterceptorTests { @@ -137,7 +137,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withRollbackOnRuntimeException() {
void withRollbackOnRuntimeException() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithExceptions());
proxyFactory.addAdvice(this.ti);
@ -154,7 +154,7 @@ public class AnnotationTransactionInterceptorTests { @@ -154,7 +154,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withCommitOnCheckedException() {
void withCommitOnCheckedException() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithExceptions());
proxyFactory.addAdvice(this.ti);
@ -167,7 +167,7 @@ public class AnnotationTransactionInterceptorTests { @@ -167,7 +167,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withRollbackOnCheckedExceptionAndRollbackRule() {
void withRollbackOnCheckedExceptionAndRollbackRule() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithExceptions());
proxyFactory.addAdvice(this.ti);
@ -180,7 +180,7 @@ public class AnnotationTransactionInterceptorTests { @@ -180,7 +180,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withMonoSuccess() {
void withMonoSuccess() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -192,7 +192,7 @@ public class AnnotationTransactionInterceptorTests { @@ -192,7 +192,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withMonoFailure() {
void withMonoFailure() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -204,7 +204,7 @@ public class AnnotationTransactionInterceptorTests { @@ -204,7 +204,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withMonoRollback() {
void withMonoRollback() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -216,7 +216,7 @@ public class AnnotationTransactionInterceptorTests { @@ -216,7 +216,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withFluxSuccess() {
void withFluxSuccess() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -228,7 +228,7 @@ public class AnnotationTransactionInterceptorTests { @@ -228,7 +228,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withFluxFailure() {
void withFluxFailure() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -240,7 +240,7 @@ public class AnnotationTransactionInterceptorTests { @@ -240,7 +240,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withFluxRollback() {
void withFluxRollback() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
@ -252,7 +252,7 @@ public class AnnotationTransactionInterceptorTests { @@ -252,7 +252,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withVavrTrySuccess() {
void withVavrTrySuccess() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithVavrTry());
proxyFactory.addAdvice(this.ti);
@ -264,7 +264,7 @@ public class AnnotationTransactionInterceptorTests { @@ -264,7 +264,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withVavrTryRuntimeException() {
void withVavrTryRuntimeException() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithVavrTry());
proxyFactory.addAdvice(this.ti);
@ -276,7 +276,7 @@ public class AnnotationTransactionInterceptorTests { @@ -276,7 +276,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withVavrTryCheckedException() {
void withVavrTryCheckedException() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithVavrTry());
proxyFactory.addAdvice(this.ti);
@ -288,7 +288,7 @@ public class AnnotationTransactionInterceptorTests { @@ -288,7 +288,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withVavrTryCheckedExceptionAndRollbackRule() {
void withVavrTryCheckedExceptionAndRollbackRule() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithVavrTry());
proxyFactory.addAdvice(this.ti);
@ -300,7 +300,7 @@ public class AnnotationTransactionInterceptorTests { @@ -300,7 +300,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withInterface() {
void withInterface() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithInterfaceImpl());
proxyFactory.addInterface(TestWithInterface.class);
@ -325,7 +325,7 @@ public class AnnotationTransactionInterceptorTests { @@ -325,7 +325,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void crossClassInterfaceMethodLevelOnJdkProxy() {
void crossClassInterfaceMethodLevelOnJdkProxy() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new SomeServiceImpl());
proxyFactory.addInterface(SomeService.class);
@ -344,7 +344,7 @@ public class AnnotationTransactionInterceptorTests { @@ -344,7 +344,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void crossClassInterfaceOnJdkProxy() {
void crossClassInterfaceOnJdkProxy() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new OtherServiceImpl());
proxyFactory.addInterface(OtherService.class);
@ -357,7 +357,7 @@ public class AnnotationTransactionInterceptorTests { @@ -357,7 +357,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withInterfaceOnTargetJdkProxy() {
void withInterfaceOnTargetJdkProxy() {
ProxyFactory targetFactory = new ProxyFactory();
targetFactory.setTarget(new TestWithInterfaceImpl());
targetFactory.addInterface(TestWithInterface.class);
@ -386,7 +386,7 @@ public class AnnotationTransactionInterceptorTests { @@ -386,7 +386,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Test
public void withInterfaceOnTargetCglibProxy() {
void withInterfaceOnTargetCglibProxy() {
ProxyFactory targetFactory = new ProxyFactory();
targetFactory.setTarget(new TestWithInterfaceImpl());
targetFactory.setProxyTargetClass(true);
@ -436,7 +436,7 @@ public class AnnotationTransactionInterceptorTests { @@ -436,7 +436,7 @@ public class AnnotationTransactionInterceptorTests {
@Transactional
public static class TestClassLevelOnly {
static class TestClassLevelOnly {
public void doSomething() {
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
@ -451,7 +451,7 @@ public class AnnotationTransactionInterceptorTests { @@ -451,7 +451,7 @@ public class AnnotationTransactionInterceptorTests {
@Transactional
public static class TestWithSingleMethodOverride {
static class TestWithSingleMethodOverride {
public void doSomething() {
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
@ -472,7 +472,7 @@ public class AnnotationTransactionInterceptorTests { @@ -472,7 +472,7 @@ public class AnnotationTransactionInterceptorTests {
@Transactional(readOnly = true)
public static class TestWithSingleMethodOverrideInverted {
static class TestWithSingleMethodOverrideInverted {
@Transactional
public void doSomething() {
@ -493,7 +493,7 @@ public class AnnotationTransactionInterceptorTests { @@ -493,7 +493,7 @@ public class AnnotationTransactionInterceptorTests {
@Transactional
public static class TestWithMultiMethodOverride {
static class TestWithMultiMethodOverride {
@Transactional(readOnly = true)
public void doSomething() {
@ -515,7 +515,7 @@ public class AnnotationTransactionInterceptorTests { @@ -515,7 +515,7 @@ public class AnnotationTransactionInterceptorTests {
@Transactional
public static class TestWithExceptions {
static class TestWithExceptions {
public void doSomethingErroneous() {
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
@ -545,7 +545,7 @@ public class AnnotationTransactionInterceptorTests { @@ -545,7 +545,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Transactional
public static class TestWithReactive {
static class TestWithReactive {
public Mono<Void> monoSuccess() {
return Mono.delay(Duration.ofSeconds(10)).then();
@ -565,7 +565,7 @@ public class AnnotationTransactionInterceptorTests { @@ -565,7 +565,7 @@ public class AnnotationTransactionInterceptorTests {
}
@Transactional
public static class TestWithVavrTry {
static class TestWithVavrTry {
public Try<String> doSomething() {
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
@ -594,14 +594,14 @@ public class AnnotationTransactionInterceptorTests { @@ -594,14 +594,14 @@ public class AnnotationTransactionInterceptorTests {
}
public interface BaseInterface {
interface BaseInterface {
void doSomething();
}
@Transactional
public interface TestWithInterface extends BaseInterface {
interface TestWithInterface extends BaseInterface {
@Transactional(readOnly = true)
void doSomethingElse();
@ -613,7 +613,7 @@ public class AnnotationTransactionInterceptorTests { @@ -613,7 +613,7 @@ public class AnnotationTransactionInterceptorTests {
}
public static class TestWithInterfaceImpl implements TestWithInterface {
static class TestWithInterfaceImpl implements TestWithInterface {
@Override
public void doSomething() {
@ -629,7 +629,7 @@ public class AnnotationTransactionInterceptorTests { @@ -629,7 +629,7 @@ public class AnnotationTransactionInterceptorTests {
}
public interface SomeService {
interface SomeService {
void foo();
@ -641,7 +641,7 @@ public class AnnotationTransactionInterceptorTests { @@ -641,7 +641,7 @@ public class AnnotationTransactionInterceptorTests {
}
public static class SomeServiceImpl implements SomeService {
static class SomeServiceImpl implements SomeService {
@Override
public void bar() {
@ -659,14 +659,14 @@ public class AnnotationTransactionInterceptorTests { @@ -659,14 +659,14 @@ public class AnnotationTransactionInterceptorTests {
}
public interface OtherService {
interface OtherService {
void foo();
}
@Transactional
public static class OtherServiceImpl implements OtherService {
static class OtherServiceImpl implements OtherService {
@Override
public void foo() {

Loading…
Cancel
Save