Stop using RuntimeHintsUtils

Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29059
This commit is contained in:
Sébastien Deleuze
2022-09-07 10:10:07 +02:00
parent 1e8017107a
commit 9cfe79186d
12 changed files with 1 additions and 212 deletions

View File

@@ -1,43 +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.messaging.handler.annotation;
import java.util.stream.Stream;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Controller;
/**
* {@link RuntimeHintsRegistrar} implementation that makes messaging
* annotations available at runtime.
*
* @author Sebastien Deleuze
* @since 6.0
*/
public class MessagingAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
@SuppressWarnings("deprecation")
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
Stream.of(Controller.class, Header.class, Headers.class, Payload.class).forEach(annotationType ->
RuntimeHintsUtils.registerSynthesizedAnnotation(hints, annotationType));
}
}

View File

@@ -1,38 +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.messaging.simp.annotation;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
/**
* {@link RuntimeHintsRegistrar} implementation that makes Simp annotations
* available at runtime.
*
* @author Sebastien Deleuze
* @since 6.0
*/
public class SimpAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
@Override
@SuppressWarnings("deprecation")
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
RuntimeHintsUtils.registerSynthesizedAnnotation(hints, SendToUser.class);
}
}

View File

@@ -27,7 +27,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportRuntimeHints;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.core.task.TaskExecutor;
import org.springframework.lang.Nullable;
@@ -41,12 +40,10 @@ 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.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.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 +95,6 @@ import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBea
* @author Sebastien Deleuze
* @since 4.0
*/
@ImportRuntimeHints({ MessagingAnnotationsRuntimeHints.class, SimpAnnotationsRuntimeHints.class })
public abstract class AbstractMessageBrokerConfiguration implements ApplicationContextAware {
private static final String MVC_VALIDATOR_NAME = "mvcValidator";