Register reflection hints for SslBundleSslEngineFactory

Closes gh-44435
This commit is contained in:
Moritz Halbritter
2025-02-26 10:51:48 +01:00
parent 453002b77b
commit abf320d273
2 changed files with 28 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -45,6 +45,9 @@ import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.ssl.SslAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
@@ -856,6 +859,15 @@ class KafkaAutoConfigurationTests {
});
}
@Test
void shouldRegisterRuntimeHints() {
RuntimeHints runtimeHints = new RuntimeHints();
new KafkaAutoConfiguration.KafkaRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader());
assertThat(RuntimeHintsPredicates.reflection()
.onType(SslBundleSslEngineFactory.class)
.withMemberCategories(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(runtimeHints);
}
private KafkaConnectionDetails kafkaConnectionDetails() {
return new KafkaConnectionDetails() {