diff --git a/spring-aop/src/main/java/org/springframework/aop/SpringProxyRuntimeHintsRegistrar.java b/spring-aop/src/main/java/org/springframework/aop/SpringProxyRuntimeHintsRegistrar.java new file mode 100644 index 00000000000..41f311562ef --- /dev/null +++ b/spring-aop/src/main/java/org/springframework/aop/SpringProxyRuntimeHintsRegistrar.java @@ -0,0 +1,37 @@ +/* + * Copyright 2002-2012 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.aop; + +import org.springframework.aop.framework.Advised; +import org.springframework.aot.hint.RuntimeHints; +import org.springframework.aot.hint.RuntimeHintsRegistrar; +import org.springframework.core.DecoratingProxy; + +/** + * {@link RuntimeHintsRegistrar} implementation that registers runtime hints for + * AOP proxies. + * + * @author Sebastien Deleuze + * @since 6.0 + */ +public class SpringProxyRuntimeHintsRegistrar implements RuntimeHintsRegistrar { + + @Override + public void registerHints(RuntimeHints hints, ClassLoader classLoader) { + hints.proxies().registerJdkProxy(SpringProxy.class, Advised.class, DecoratingProxy.class); + } +} diff --git a/spring-aop/src/main/resources/META-INF/spring/aot.factories b/spring-aop/src/main/resources/META-INF/spring/aot.factories index 7264434e5cb..e514abff10e 100644 --- a/spring-aop/src/main/resources/META-INF/spring/aot.factories +++ b/spring-aop/src/main/resources/META-INF/spring/aot.factories @@ -1,2 +1,4 @@ org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\ org.springframework.aop.scope.ScopedProxyBeanRegistrationAotProcessor +org.springframework.aot.hint.RuntimeHintsRegistrar=\ +org.springframework.aop.SpringProxyRuntimeHintsRegistrar \ No newline at end of file diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java index 6eb7086c07f..d0b004b20d9 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java @@ -23,6 +23,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.aot.hint.annotation.Reflective; import org.springframework.core.annotation.AliasFor; import org.springframework.transaction.TransactionDefinition; @@ -117,6 +118,7 @@ import org.springframework.transaction.TransactionDefinition; @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented +@Reflective public @interface Transactional { /**