Browse Source

Harmonize RuntimeHintsRegistrar implementations

Closes gh-28801
pull/28804/head
Stephane Nicoll 2 years ago
parent
commit
2c92d7da8f
  1. 2
      spring-beans/src/main/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHints.java
  2. 3
      spring-beans/src/main/resources/META-INF/spring/aot.factories
  3. 5
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsTests.java
  4. 3
      spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailMimeTypesRuntimeHints.java
  5. 2
      spring-context-support/src/main/resources/META-INF/spring/aot.factories
  6. 16
      spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java
  7. 37
      spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationRuntimeHintsRegistrar.java
  8. 16
      spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationPostProcessor.java
  9. 40
      spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationRuntimeHintsRegistrar.java
  10. 2
      spring-core/src/main/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHints.java
  11. 4
      spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java
  12. 4
      spring-core/src/main/resources/META-INF/spring/aot.factories
  13. 6
      spring-core/src/test/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsTests.java
  14. 4
      spring-core/src/test/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsTests.java
  15. 2
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/MessagingAnnotationsRuntimeHints.java
  16. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SimpAnnotationsRuntimeHints.java
  17. 6
      spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
  18. 2
      spring-tx/src/main/java/org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.java
  19. 6
      spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionBeanRegistrationAotProcessor.java
  20. 18
      spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java
  21. 2
      spring-web/src/main/java/org/springframework/http/HttpMimeTypesRuntimeHints.java
  22. 2
      spring-web/src/main/java/org/springframework/http/codec/CodecConfigurerRuntimeHints.java
  23. 3
      spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java
  24. 6
      spring-web/src/main/resources/META-INF/spring/aot.factories
  25. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java
  26. 2
      spring-websocket/src/main/resources/META-INF/spring/aot.factories

2
spring-beans/src/main/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsRegistrar.java → spring-beans/src/main/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHints.java

@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils; @@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils;
*
* @author Brian Clozel
*/
class JakartaAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class JakartaAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {

3
spring-beans/src/main/resources/META-INF/spring/aot.factories

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.beans.factory.annotation.JakartaAnnotationsRuntimeHintsRegistrar
org.springframework.beans.factory.annotation.JakartaAnnotationsRuntimeHints

5
spring-beans/src/test/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsRegistrarTests.java → spring-beans/src/test/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsTests.java

@ -33,10 +33,11 @@ import org.springframework.util.ClassUtils; @@ -33,10 +33,11 @@ import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link JakartaAnnotationsRuntimeHintsRegistrar}.
* Tests for {@link JakartaAnnotationsRuntimeHints}.
*
* @author Brian Clozel
*/
class JakartaAnnotationsRuntimeHintsRegistrarTests {
class JakartaAnnotationsRuntimeHintsTests {
private final RuntimeHints hints = new RuntimeHints();

3
spring-context-support/src/main/java/org/springframework/mail/javamail/MimeTypeResourceHintsRegistrar.java → spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailMimeTypesRuntimeHints.java

@ -27,10 +27,11 @@ import org.springframework.lang.Nullable; @@ -27,10 +27,11 @@ import org.springframework.lang.Nullable;
* @author Sebastien Deleuze
* @since 6.0
*/
class MimeTypeResourceHintsRegistrar implements RuntimeHintsRegistrar {
class JavaMailMimeTypesRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.resources().registerPattern("org/springframework/mail/javamail/mime.types");
}
}

2
spring-context-support/src/main/resources/META-INF/spring/aot.factories

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar= \
org.springframework.mail.javamail.MimeTypeResourceHintsRegistrar
org.springframework.mail.javamail.JavaMailMimeTypesRuntimeHints

16
spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java

@ -37,6 +37,9 @@ import org.apache.commons.logging.LogFactory; @@ -37,6 +37,9 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.aop.support.AopUtils;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
@ -65,6 +68,7 @@ import org.springframework.core.annotation.AnnotationUtils; @@ -65,6 +68,7 @@ import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.ScheduledAnnotationsRuntimeHints;
import org.springframework.scheduling.config.CronTask;
import org.springframework.scheduling.config.FixedDelayTask;
import org.springframework.scheduling.config.FixedRateTask;
@ -107,7 +111,7 @@ import org.springframework.util.StringValueResolver; @@ -107,7 +111,7 @@ import org.springframework.util.StringValueResolver;
* @see org.springframework.scheduling.config.ScheduledTaskRegistrar
* @see AsyncAnnotationBeanPostProcessor
*/
@ImportRuntimeHints(ScheduledAnnotationRuntimeHintsRegistrar.class)
@ImportRuntimeHints(ScheduledAnnotationsRuntimeHints.class)
public class ScheduledAnnotationBeanPostProcessor
implements ScheduledTaskHolder, MergedBeanDefinitionPostProcessor, DestructionAwareBeanPostProcessor,
Ordered, EmbeddedValueResolverAware, BeanNameAware, BeanFactoryAware, ApplicationContextAware,
@ -607,4 +611,14 @@ public class ScheduledAnnotationBeanPostProcessor @@ -607,4 +611,14 @@ public class ScheduledAnnotationBeanPostProcessor
this.registrar.destroy();
}
static class ScheduledAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
RuntimeHintsUtils.registerAnnotation(hints, Scheduled.class);
RuntimeHintsUtils.registerAnnotation(hints, Schedules.class);
}
}
}

37
spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationRuntimeHintsRegistrar.java

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
/*
* Copyright 2002-2022 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.scheduling.annotation;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
/**
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints for
* {@link Scheduled} annotation.
*
* @author Sebastien Deleuze
* @since 6.0
*/
public class ScheduledAnnotationRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
RuntimeHintsUtils.registerAnnotation(hints, Scheduled.class);
RuntimeHintsUtils.registerAnnotation(hints, Schedules.class);
}
}

16
spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationPostProcessor.java

@ -23,15 +23,19 @@ import jakarta.validation.ValidatorFactory; @@ -23,15 +23,19 @@ import jakarta.validation.ValidatorFactory;
import org.aopalliance.aop.Advice;
import org.springframework.aop.Pointcut;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.ImportRuntimeHints;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor.MethodValidationRuntimeHints;
/**
* A convenient {@link BeanPostProcessor} implementation that delegates to a
@ -58,7 +62,7 @@ import org.springframework.validation.annotation.Validated; @@ -58,7 +62,7 @@ import org.springframework.validation.annotation.Validated;
* @see jakarta.validation.executable.ExecutableValidator
*/
@SuppressWarnings("serial")
@ImportRuntimeHints(MethodValidationRuntimeHintsRegistrar.class)
@ImportRuntimeHints(MethodValidationRuntimeHints.class)
public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor
implements InitializingBean {
@ -127,4 +131,14 @@ public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvis @@ -127,4 +131,14 @@ public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvis
return (validator != null ? new MethodValidationInterceptor(validator) : new MethodValidationInterceptor());
}
static class MethodValidationRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.proxies().registerJdkProxy(AopProxyUtils.completeJdkProxyInterfaces(Validator.class));
}
}
}

40
spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationRuntimeHintsRegistrar.java

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
/*
* Copyright 2002-2022 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.validation.beanvalidation;
import jakarta.validation.Validator;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.lang.Nullable;
/**
* {@link RuntimeHintsRegistrar} implementation that registers proxy entries
* for {@link MethodValidationPostProcessor}.
*
* @author Sebastien Deleuze
* @since 6.0
*/
public class MethodValidationRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.proxies().registerJdkProxy(AopProxyUtils.completeJdkProxyInterfaces(Validator.class));
}
}

2
spring-core/src/main/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsRegistrar.java → spring-core/src/main/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHints.java

@ -30,7 +30,7 @@ import org.springframework.lang.Nullable; @@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
* @author Phillip Webb
* @since 6.0
*/
class CoreAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class CoreAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {

4
spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsRegistrar.java → spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java

@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils; @@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
* @since 6.0
* @see SpringFactoriesLoader
*/
class SpringFactoriesLoaderRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
private static final List<String> RESOURCE_LOCATIONS =
List.of(SpringFactoriesLoader.FACTORIES_RESOURCE_LOCATION);
@ -48,7 +48,7 @@ class SpringFactoriesLoaderRuntimeHintsRegistrar implements RuntimeHintsRegistra @@ -48,7 +48,7 @@ class SpringFactoriesLoaderRuntimeHintsRegistrar implements RuntimeHintsRegistra
private static final Consumer<TypeHint.Builder> HINT = builder ->
builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
private static final Log logger = LogFactory.getLog(SpringFactoriesLoaderRuntimeHintsRegistrar.class);
private static final Log logger = LogFactory.getLog(SpringFactoriesLoaderRuntimeHints.class);
@Override

4
spring-core/src/main/resources/META-INF/spring/aot.factories

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.aot.hint.support.CoreAnnotationsRuntimeHintsRegistrar,\
org.springframework.aot.hint.support.SpringFactoriesLoaderRuntimeHintsRegistrar
org.springframework.aot.hint.support.CoreAnnotationsRuntimeHints,\
org.springframework.aot.hint.support.SpringFactoriesLoaderRuntimeHints

6
spring-core/src/test/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsRegistrarTests.java → spring-core/src/test/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsTests.java

@ -31,13 +31,13 @@ import org.springframework.util.ClassUtils; @@ -31,13 +31,13 @@ import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link CoreAnnotationsRuntimeHintsRegistrar}.
* Tests for {@link CoreAnnotationsRuntimeHints}.
*
* @author Phillip Webb
*/
class CoreAnnotationsRuntimeHintsRegistrarTests {
class CoreAnnotationsRuntimeHintsTests {
private RuntimeHints hints = new RuntimeHints();
private final RuntimeHints hints = new RuntimeHints();
@BeforeEach
void setup() {

4
spring-core/src/test/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsRegistrarTests.java → spring-core/src/test/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsTests.java

@ -31,11 +31,11 @@ import org.springframework.util.ClassUtils; @@ -31,11 +31,11 @@ import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link SpringFactoriesLoaderRuntimeHintsRegistrar}.
* Tests for {@link SpringFactoriesLoaderRuntimeHints}.
*
* @author Phillip Webb
*/
class SpringFactoriesLoaderRuntimeHintsRegistrarTests {
class SpringFactoriesLoaderRuntimeHintsTests {
private RuntimeHints hints;

2
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/MessagingAnnotationsRuntimeHintsRegistrar.java → spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/MessagingAnnotationsRuntimeHints.java

@ -31,7 +31,7 @@ import org.springframework.stereotype.Controller; @@ -31,7 +31,7 @@ import org.springframework.stereotype.Controller;
* @author Sebastien Deleuze
* @since 6.0
*/
public class MessagingAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
public class MessagingAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {

2
spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SimpAnnotationsRuntimeHintsRegistrar.java → spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SimpAnnotationsRuntimeHints.java

@ -29,7 +29,7 @@ import org.springframework.aot.hint.support.RuntimeHintsUtils; @@ -29,7 +29,7 @@ import org.springframework.aot.hint.support.RuntimeHintsUtils;
* @author Sebastien Deleuze
* @since 6.0
*/
public class SimpAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
public class SimpAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {

6
spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java

@ -42,12 +42,12 @@ import org.springframework.messaging.converter.KotlinSerializationJsonMessageCon @@ -42,12 +42,12 @@ import org.springframework.messaging.converter.KotlinSerializationJsonMessageCon
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.converter.MessageConverter;
import org.springframework.messaging.converter.StringMessageConverter;
import org.springframework.messaging.handler.annotation.MessagingAnnotationsRuntimeHintsRegistrar;
import org.springframework.messaging.handler.annotation.MessagingAnnotationsRuntimeHints;
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver;
import org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler;
import org.springframework.messaging.simp.SimpLogging;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.messaging.simp.annotation.SimpAnnotationsRuntimeHintsRegistrar;
import org.springframework.messaging.simp.annotation.SimpAnnotationsRuntimeHints;
import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler;
import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler;
import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler;
@ -98,7 +98,7 @@ import org.springframework.validation.Validator; @@ -98,7 +98,7 @@ import org.springframework.validation.Validator;
* @author Sebastien Deleuze
* @since 4.0
*/
@ImportRuntimeHints({ MessagingAnnotationsRuntimeHintsRegistrar.class, SimpAnnotationsRuntimeHintsRegistrar.class })
@ImportRuntimeHints({ MessagingAnnotationsRuntimeHints.class, SimpAnnotationsRuntimeHints.class })
public abstract class AbstractMessageBrokerConfiguration implements ApplicationContextAware {
private static final String MVC_VALIDATOR_NAME = "mvcValidator";

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

@ -38,7 +38,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor; @@ -38,7 +38,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
*/
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ImportRuntimeHints(TransactionRuntimeHintsRegistrar.class)
@ImportRuntimeHints(TransactionRuntimeHints.class)
public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)

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

@ -39,9 +39,9 @@ import org.springframework.util.ReflectionUtils; @@ -39,9 +39,9 @@ import org.springframework.util.ReflectionUtils;
*
* @author Sebastien Deleuze
* @since 6.0
* @see TransactionRuntimeHintsRegistrar
* @see TransactionRuntimeHints
*/
public class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {
class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {
private final static String JAKARTA_TRANSACTIONAL_CLASS_NAME = "jakarta.transaction.Transactional";
@ -70,7 +70,7 @@ public class TransactionBeanRegistrationAotProcessor implements BeanRegistration @@ -70,7 +70,7 @@ public class TransactionBeanRegistrationAotProcessor implements BeanRegistration
private static class TransactionBeanRegistrationAotContribution implements BeanRegistrationAotContribution {
private Class<?> beanClass;
private final Class<?> beanClass;
public TransactionBeanRegistrationAotContribution(Class<?> beanClass) {
this.beanClass = beanClass;

18
spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHintsRegistrar.java → spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java

@ -16,13 +16,14 @@ @@ -16,13 +16,14 @@
package org.springframework.transaction.annotation;
import java.util.List;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import static java.util.Arrays.asList;
import org.springframework.transaction.TransactionDefinition;
/**
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints for
@ -32,17 +33,16 @@ import static java.util.Arrays.asList; @@ -32,17 +33,16 @@ import static java.util.Arrays.asList;
* @since 6.0
* @see TransactionBeanRegistrationAotProcessor
*/
public class TransactionRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class TransactionRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
RuntimeHintsUtils.registerAnnotation(hints, org.springframework.transaction.annotation.Transactional.class);
RuntimeHintsUtils.registerAnnotation(hints, Transactional.class);
hints.reflection()
.registerTypes(asList(
TypeReference.of(org.springframework.transaction.annotation.Isolation.class),
TypeReference.of(org.springframework.transaction.annotation.Propagation.class),
TypeReference.of(org.springframework.transaction.TransactionDefinition.class)),
.registerTypes(List.of(
TypeReference.of(Isolation.class),
TypeReference.of(Propagation.class),
TypeReference.of(TransactionDefinition.class)),
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS));
}
}

2
spring-web/src/main/java/org/springframework/http/MediaTypeResourceHintsRegistrar.java → spring-web/src/main/java/org/springframework/http/HttpMimeTypesRuntimeHints.java

@ -27,7 +27,7 @@ import org.springframework.lang.Nullable; @@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
* @author Stephane Nicoll
* @since 6.0
*/
class MediaTypeResourceHintsRegistrar implements RuntimeHintsRegistrar {
class HttpMimeTypesRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {

2
spring-web/src/main/java/org/springframework/http/codec/CodecConfigurerHintsRegistrar.java → spring-web/src/main/java/org/springframework/http/codec/CodecConfigurerRuntimeHints.java

@ -31,7 +31,7 @@ import org.springframework.lang.Nullable; @@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
* @author Sebastien Deleuze
* @since 6.0
*/
public class CodecConfigurerHintsRegistrar implements RuntimeHintsRegistrar {
class CodecConfigurerRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {

3
spring-web/src/main/java/org/springframework/http/converter/json/JacksonBuilderRuntimeHintsRegistrar.java → spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java

@ -29,7 +29,8 @@ import org.springframework.aot.hint.TypeReference; @@ -29,7 +29,8 @@ import org.springframework.aot.hint.TypeReference;
* @author Sebastien Deleuze
* @since 6.0
*/
public class JacksonBuilderRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class JacksonModulesRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
ReflectionHints reflectionHints = hints.reflection();

6
spring-web/src/main/resources/META-INF/spring/aot.factories

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
org.springframework.aot.hint.RuntimeHintsRegistrar= \
org.springframework.http.MediaTypeResourceHintsRegistrar,\
org.springframework.http.codec.CodecConfigurerHintsRegistrar,\
org.springframework.http.converter.json.JacksonBuilderRuntimeHintsRegistrar
org.springframework.http.HttpMimeTypesRuntimeHints,\
org.springframework.http.codec.CodecConfigurerRuntimeHints,\
org.springframework.http.converter.json.JacksonModulesRuntimeHints

2
spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHintsRegistrar.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java

@ -30,7 +30,7 @@ import org.springframework.util.ClassUtils; @@ -30,7 +30,7 @@ import org.springframework.util.ClassUtils;
* @author Sebastien Deleuze
* @since 6.0
*/
public class HandshakeHandlerRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
class HandshakeHandlerRuntimeHints implements RuntimeHintsRegistrar {
private static final boolean tomcatWsPresent;

2
spring-websocket/src/main/resources/META-INF/spring/aot.factories

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar= \
org.springframework.web.socket.server.support.HandshakeHandlerRuntimeHintsRegistrar
org.springframework.web.socket.server.support.HandshakeHandlerRuntimeHints
Loading…
Cancel
Save