feat: Implemented to throw a runtime error if a class has @Transactional

This commit is contained in:
오영택
2024-09-03 15:48:01 +09:00
committed by Juergen Hoeller
parent e3cf23d15a
commit cc3948e14c
2 changed files with 57 additions and 0 deletions

View File

@@ -38,6 +38,11 @@ public class RestrictedTransactionalEventListenerFactory extends TransactionalEv
@Override
public ApplicationListener<?> createApplicationListener(String beanName, Class<?> type, Method method) {
Transactional txAnn = AnnotatedElementUtils.findMergedAnnotation(method, Transactional.class);
if (txAnn == null) {
txAnn = AnnotatedElementUtils.findMergedAnnotation(type, Transactional.class);
}
if (txAnn != null) {
Propagation propagation = txAnn.propagation();
if (propagation != Propagation.REQUIRES_NEW && propagation != Propagation.NOT_SUPPORTED) {