Remove unnecessary workaround

See gh-29091
This commit is contained in:
Stephane Nicoll 2022-09-07 07:50:49 +02:00
parent 323d1907c1
commit 1e8017107a
1 changed files with 1 additions and 15 deletions

View File

@ -20,10 +20,7 @@ import java.util.function.BiConsumer;
import org.junit.jupiter.api.Test;
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.test.agent.EnabledIfRuntimeHintsAgent;
import org.springframework.aot.test.agent.RuntimeHintsInvocations;
import org.springframework.aot.test.agent.RuntimeHintsRecorder;
@ -80,18 +77,7 @@ class ApplicationContextAotGeneratorRuntimeHintsTests {
beanDefinition.setInitMethodName("customInit");
beanDefinition.setDestroyMethodName("customDestroy");
context.registerBeanDefinition("initDestroyComponent", beanDefinition);
compile(context, (hints, invocations) -> assertThat(invocations)
.withRegistrar(new InitDestroyIssueRegistrar()).match(hints));
}
// TODO: Remove once https://github.com/spring-projects/spring-framework/issues/29077 is fixed
static class InitDestroyIssueRegistrar implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.reflection()
.registerType(TypeReference.of(InitDestroyComponent.class.getName()), typeHint ->
typeHint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
}
compile(context, (hints, invocations) -> assertThat(invocations).match(hints));
}
@SuppressWarnings({ "rawtypes", "unchecked" })