Skip to content

Commit 30e75e4

Browse files
committed
Enable efficient pointcut checks for composite sources as well
Closes gh-20072
1 parent 1fa6ac3 commit 30e75e4

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

spring-context/src/main/java/org/springframework/cache/interceptor/CompositeCacheOperationSource.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,6 +66,16 @@ public boolean isCandidateClass(Class<?> targetClass) {
6666
return false;
6767
}
6868

69+
@Override
70+
public boolean hasCacheOperations(Method method, @Nullable Class<?> targetClass) {
71+
for (CacheOperationSource source : this.cacheOperationSources) {
72+
if (source.hasCacheOperations(method, targetClass)) {
73+
return true;
74+
}
75+
}
76+
return false;
77+
}
78+
6979
@Override
7080
@Nullable
7181
public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) {

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,6 +63,16 @@ public boolean isCandidateClass(Class<?> targetClass) {
6363
return false;
6464
}
6565

66+
@Override
67+
public boolean hasTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
68+
for (TransactionAttributeSource source : this.transactionAttributeSources) {
69+
if (source.hasTransactionAttribute(method, targetClass)) {
70+
return true;
71+
}
72+
}
73+
return false;
74+
}
75+
6676
@Override
6777
@Nullable
6878
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {

0 commit comments

Comments
 (0)