Skip to content

Commit 37bebea

Browse files
committed
Accept protected @Transactional/Cacheable methods on CGLIB proxies
Closes gh-25582
1 parent 32b8710 commit 37bebea

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -56,7 +56,8 @@ public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor(
5656
@Bean
5757
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
5858
public CacheOperationSource cacheOperationSource() {
59-
return new AnnotationCacheOperationSource();
59+
// Accept protected @Cacheable etc methods on CGLIB proxies, as of 6.0.
60+
return new AnnotationCacheOperationSource(false);
6061
}
6162

6263
@Bean

spring-tx/src/main/java/org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -56,7 +56,8 @@ public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor(
5656
@Bean
5757
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
5858
public TransactionAttributeSource transactionAttributeSource() {
59-
return new AnnotationTransactionAttributeSource();
59+
// Accept protected @Transactional methods on CGLIB proxies, as of 6.0.
60+
return new AnnotationTransactionAttributeSource(false);
6061
}
6162

6263
@Bean

0 commit comments

Comments
 (0)