Harmonize RuntimeHintsRegistrar implementations
Closes gh-28801
This commit is contained in:
parent
44d7e2775f
commit
2c92d7da8f
|
@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils;
|
||||||
*
|
*
|
||||||
* @author Brian Clozel
|
* @author Brian Clozel
|
||||||
*/
|
*/
|
||||||
class JakartaAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class JakartaAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
@ -1,4 +1,5 @@
|
||||||
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
|
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
|
||||||
org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor
|
org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor
|
||||||
|
|
||||||
org.springframework.aot.hint.RuntimeHintsRegistrar=\
|
org.springframework.aot.hint.RuntimeHintsRegistrar=\
|
||||||
org.springframework.beans.factory.annotation.JakartaAnnotationsRuntimeHintsRegistrar
|
org.springframework.beans.factory.annotation.JakartaAnnotationsRuntimeHints
|
|
@ -33,10 +33,11 @@ import org.springframework.util.ClassUtils;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link JakartaAnnotationsRuntimeHintsRegistrar}.
|
* Tests for {@link JakartaAnnotationsRuntimeHints}.
|
||||||
|
*
|
||||||
* @author Brian Clozel
|
* @author Brian Clozel
|
||||||
*/
|
*/
|
||||||
class JakartaAnnotationsRuntimeHintsRegistrarTests {
|
class JakartaAnnotationsRuntimeHintsTests {
|
||||||
|
|
||||||
private final RuntimeHints hints = new RuntimeHints();
|
private final RuntimeHints hints = new RuntimeHints();
|
||||||
|
|
|
@ -27,10 +27,11 @@ import org.springframework.lang.Nullable;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
class MimeTypeResourceHintsRegistrar implements RuntimeHintsRegistrar {
|
class JavaMailMimeTypesRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||||
hints.resources().registerPattern("org/springframework/mail/javamail/mime.types");
|
hints.resources().registerPattern("org/springframework/mail/javamail/mime.types");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,2 +1,2 @@
|
||||||
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
||||||
org.springframework.mail.javamail.MimeTypeResourceHintsRegistrar
|
org.springframework.mail.javamail.JavaMailMimeTypesRuntimeHints
|
|
@ -37,6 +37,9 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.aop.framework.AopInfrastructureBean;
|
import org.springframework.aop.framework.AopInfrastructureBean;
|
||||||
import org.springframework.aop.framework.AopProxyUtils;
|
import org.springframework.aop.framework.AopProxyUtils;
|
||||||
import org.springframework.aop.support.AopUtils;
|
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.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.BeanNameAware;
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
@ -65,6 +68,7 @@ import org.springframework.core.annotation.AnnotationUtils;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.scheduling.TaskScheduler;
|
import org.springframework.scheduling.TaskScheduler;
|
||||||
import org.springframework.scheduling.Trigger;
|
import org.springframework.scheduling.Trigger;
|
||||||
|
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.ScheduledAnnotationsRuntimeHints;
|
||||||
import org.springframework.scheduling.config.CronTask;
|
import org.springframework.scheduling.config.CronTask;
|
||||||
import org.springframework.scheduling.config.FixedDelayTask;
|
import org.springframework.scheduling.config.FixedDelayTask;
|
||||||
import org.springframework.scheduling.config.FixedRateTask;
|
import org.springframework.scheduling.config.FixedRateTask;
|
||||||
|
@ -107,7 +111,7 @@ import org.springframework.util.StringValueResolver;
|
||||||
* @see org.springframework.scheduling.config.ScheduledTaskRegistrar
|
* @see org.springframework.scheduling.config.ScheduledTaskRegistrar
|
||||||
* @see AsyncAnnotationBeanPostProcessor
|
* @see AsyncAnnotationBeanPostProcessor
|
||||||
*/
|
*/
|
||||||
@ImportRuntimeHints(ScheduledAnnotationRuntimeHintsRegistrar.class)
|
@ImportRuntimeHints(ScheduledAnnotationsRuntimeHints.class)
|
||||||
public class ScheduledAnnotationBeanPostProcessor
|
public class ScheduledAnnotationBeanPostProcessor
|
||||||
implements ScheduledTaskHolder, MergedBeanDefinitionPostProcessor, DestructionAwareBeanPostProcessor,
|
implements ScheduledTaskHolder, MergedBeanDefinitionPostProcessor, DestructionAwareBeanPostProcessor,
|
||||||
Ordered, EmbeddedValueResolverAware, BeanNameAware, BeanFactoryAware, ApplicationContextAware,
|
Ordered, EmbeddedValueResolverAware, BeanNameAware, BeanFactoryAware, ApplicationContextAware,
|
||||||
|
@ -607,4 +611,14 @@ public class ScheduledAnnotationBeanPostProcessor
|
||||||
this.registrar.destroy();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,15 +23,19 @@ import jakarta.validation.ValidatorFactory;
|
||||||
import org.aopalliance.aop.Advice;
|
import org.aopalliance.aop.Advice;
|
||||||
|
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
|
import org.springframework.aop.framework.AopProxyUtils;
|
||||||
import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor;
|
import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor;
|
||||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||||
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
|
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.InitializingBean;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor.MethodValidationRuntimeHints;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenient {@link BeanPostProcessor} implementation that delegates to a
|
* A convenient {@link BeanPostProcessor} implementation that delegates to a
|
||||||
|
@ -58,7 +62,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
* @see jakarta.validation.executable.ExecutableValidator
|
* @see jakarta.validation.executable.ExecutableValidator
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@ImportRuntimeHints(MethodValidationRuntimeHintsRegistrar.class)
|
@ImportRuntimeHints(MethodValidationRuntimeHints.class)
|
||||||
public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor
|
public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor
|
||||||
implements InitializingBean {
|
implements InitializingBean {
|
||||||
|
|
||||||
|
@ -127,4 +131,14 @@ public class MethodValidationPostProcessor extends AbstractBeanFactoryAwareAdvis
|
||||||
return (validator != null ? new MethodValidationInterceptor(validator) : new MethodValidationInterceptor());
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
class CoreAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class CoreAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
|
@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
* @see SpringFactoriesLoader
|
* @see SpringFactoriesLoader
|
||||||
*/
|
*/
|
||||||
class SpringFactoriesLoaderRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
private static final List<String> RESOURCE_LOCATIONS =
|
private static final List<String> RESOURCE_LOCATIONS =
|
||||||
List.of(SpringFactoriesLoader.FACTORIES_RESOURCE_LOCATION);
|
List.of(SpringFactoriesLoader.FACTORIES_RESOURCE_LOCATION);
|
||||||
|
@ -48,7 +48,7 @@ class SpringFactoriesLoaderRuntimeHintsRegistrar implements RuntimeHintsRegistra
|
||||||
private static final Consumer<TypeHint.Builder> HINT = builder ->
|
private static final Consumer<TypeHint.Builder> HINT = builder ->
|
||||||
builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
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
|
@Override
|
|
@ -1,3 +1,3 @@
|
||||||
org.springframework.aot.hint.RuntimeHintsRegistrar=\
|
org.springframework.aot.hint.RuntimeHintsRegistrar=\
|
||||||
org.springframework.aot.hint.support.CoreAnnotationsRuntimeHintsRegistrar,\
|
org.springframework.aot.hint.support.CoreAnnotationsRuntimeHints,\
|
||||||
org.springframework.aot.hint.support.SpringFactoriesLoaderRuntimeHintsRegistrar
|
org.springframework.aot.hint.support.SpringFactoriesLoaderRuntimeHints
|
||||||
|
|
|
@ -31,13 +31,13 @@ import org.springframework.util.ClassUtils;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link CoreAnnotationsRuntimeHintsRegistrar}.
|
* Tests for {@link CoreAnnotationsRuntimeHints}.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
class CoreAnnotationsRuntimeHintsRegistrarTests {
|
class CoreAnnotationsRuntimeHintsTests {
|
||||||
|
|
||||||
private RuntimeHints hints = new RuntimeHints();
|
private final RuntimeHints hints = new RuntimeHints();
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup() {
|
void setup() {
|
|
@ -31,11 +31,11 @@ import org.springframework.util.ClassUtils;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link SpringFactoriesLoaderRuntimeHintsRegistrar}.
|
* Tests for {@link SpringFactoriesLoaderRuntimeHints}.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
class SpringFactoriesLoaderRuntimeHintsRegistrarTests {
|
class SpringFactoriesLoaderRuntimeHintsTests {
|
||||||
|
|
||||||
private RuntimeHints hints;
|
private RuntimeHints hints;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.springframework.stereotype.Controller;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class MessagingAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
public class MessagingAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
|
@ -29,7 +29,7 @@ import org.springframework.aot.hint.support.RuntimeHintsUtils;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class SimpAnnotationsRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
public class SimpAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
@ -42,12 +42,12 @@ import org.springframework.messaging.converter.KotlinSerializationJsonMessageCon
|
||||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||||
import org.springframework.messaging.converter.MessageConverter;
|
import org.springframework.messaging.converter.MessageConverter;
|
||||||
import org.springframework.messaging.converter.StringMessageConverter;
|
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.HandlerMethodArgumentResolver;
|
||||||
import org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler;
|
import org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler;
|
||||||
import org.springframework.messaging.simp.SimpLogging;
|
import org.springframework.messaging.simp.SimpLogging;
|
||||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
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.annotation.support.SimpAnnotationMethodMessageHandler;
|
||||||
import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler;
|
import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler;
|
||||||
import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler;
|
import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler;
|
||||||
|
@ -98,7 +98,7 @@ import org.springframework.validation.Validator;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
@ImportRuntimeHints({ MessagingAnnotationsRuntimeHintsRegistrar.class, SimpAnnotationsRuntimeHintsRegistrar.class })
|
@ImportRuntimeHints({ MessagingAnnotationsRuntimeHints.class, SimpAnnotationsRuntimeHints.class })
|
||||||
public abstract class AbstractMessageBrokerConfiguration implements ApplicationContextAware {
|
public abstract class AbstractMessageBrokerConfiguration implements ApplicationContextAware {
|
||||||
|
|
||||||
private static final String MVC_VALIDATOR_NAME = "mvcValidator";
|
private static final String MVC_VALIDATOR_NAME = "mvcValidator";
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
@ImportRuntimeHints(TransactionRuntimeHintsRegistrar.class)
|
@ImportRuntimeHints(TransactionRuntimeHints.class)
|
||||||
public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
|
public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
|
||||||
|
|
||||||
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
|
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
|
||||||
|
|
|
@ -39,9 +39,9 @@ import org.springframework.util.ReflectionUtils;
|
||||||
*
|
*
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @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";
|
private final static String JAKARTA_TRANSACTIONAL_CLASS_NAME = "jakarta.transaction.Transactional";
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class TransactionBeanRegistrationAotProcessor implements BeanRegistration
|
||||||
|
|
||||||
private static class TransactionBeanRegistrationAotContribution implements BeanRegistrationAotContribution {
|
private static class TransactionBeanRegistrationAotContribution implements BeanRegistrationAotContribution {
|
||||||
|
|
||||||
private Class<?> beanClass;
|
private final Class<?> beanClass;
|
||||||
|
|
||||||
public TransactionBeanRegistrationAotContribution(Class<?> beanClass) {
|
public TransactionBeanRegistrationAotContribution(Class<?> beanClass) {
|
||||||
this.beanClass = beanClass;
|
this.beanClass = beanClass;
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
|
|
||||||
package org.springframework.transaction.annotation;
|
package org.springframework.transaction.annotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.aot.hint.MemberCategory;
|
import org.springframework.aot.hint.MemberCategory;
|
||||||
import org.springframework.aot.hint.RuntimeHints;
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
import org.springframework.aot.hint.TypeReference;
|
import org.springframework.aot.hint.TypeReference;
|
||||||
import org.springframework.aot.hint.support.RuntimeHintsUtils;
|
import org.springframework.aot.hint.support.RuntimeHintsUtils;
|
||||||
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints for
|
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints for
|
||||||
|
@ -32,17 +33,16 @@ import static java.util.Arrays.asList;
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
* @see TransactionBeanRegistrationAotProcessor
|
* @see TransactionBeanRegistrationAotProcessor
|
||||||
*/
|
*/
|
||||||
public class TransactionRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class TransactionRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||||
RuntimeHintsUtils.registerAnnotation(hints, org.springframework.transaction.annotation.Transactional.class);
|
RuntimeHintsUtils.registerAnnotation(hints, Transactional.class);
|
||||||
|
|
||||||
hints.reflection()
|
hints.reflection()
|
||||||
.registerTypes(asList(
|
.registerTypes(List.of(
|
||||||
TypeReference.of(org.springframework.transaction.annotation.Isolation.class),
|
TypeReference.of(Isolation.class),
|
||||||
TypeReference.of(org.springframework.transaction.annotation.Propagation.class),
|
TypeReference.of(Propagation.class),
|
||||||
TypeReference.of(org.springframework.transaction.TransactionDefinition.class)),
|
TypeReference.of(TransactionDefinition.class)),
|
||||||
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS));
|
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
class MediaTypeResourceHintsRegistrar implements RuntimeHintsRegistrar {
|
class HttpMimeTypesRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
|
@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class CodecConfigurerHintsRegistrar implements RuntimeHintsRegistrar {
|
class CodecConfigurerRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
|
@ -29,7 +29,8 @@ import org.springframework.aot.hint.TypeReference;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class JacksonBuilderRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class JacksonModulesRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||||
ReflectionHints reflectionHints = hints.reflection();
|
ReflectionHints reflectionHints = hints.reflection();
|
|
@ -1,4 +1,4 @@
|
||||||
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
||||||
org.springframework.http.MediaTypeResourceHintsRegistrar,\
|
org.springframework.http.HttpMimeTypesRuntimeHints,\
|
||||||
org.springframework.http.codec.CodecConfigurerHintsRegistrar,\
|
org.springframework.http.codec.CodecConfigurerRuntimeHints,\
|
||||||
org.springframework.http.converter.json.JacksonBuilderRuntimeHintsRegistrar
|
org.springframework.http.converter.json.JacksonModulesRuntimeHints
|
|
@ -30,7 +30,7 @@ import org.springframework.util.ClassUtils;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class HandshakeHandlerRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
class HandshakeHandlerRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
private static final boolean tomcatWsPresent;
|
private static final boolean tomcatWsPresent;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
org.springframework.aot.hint.RuntimeHintsRegistrar= \
|
||||||
org.springframework.web.socket.server.support.HandshakeHandlerRuntimeHintsRegistrar
|
org.springframework.web.socket.server.support.HandshakeHandlerRuntimeHints
|
Loading…
Reference in New Issue