|
41 | 41 | import org.mockito.Mockito;
|
42 | 42 | import reactor.core.publisher.Mono;
|
43 | 43 |
|
| 44 | +import org.springframework.aot.hint.MemberCategory; |
| 45 | +import org.springframework.aot.hint.RuntimeHints; |
| 46 | +import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; |
44 | 47 | import org.springframework.beans.CachedIntrospectionResults;
|
45 | 48 | import org.springframework.beans.factory.BeanCreationException;
|
46 | 49 | import org.springframework.beans.factory.BeanCurrentlyInCreationException;
|
|
53 | 56 | import org.springframework.beans.factory.support.BeanNameGenerator;
|
54 | 57 | import org.springframework.beans.factory.support.DefaultBeanNameGenerator;
|
55 | 58 | import org.springframework.boot.BootstrapRegistry.InstanceSupplier;
|
| 59 | +import org.springframework.boot.SpringApplication.SpringApplicationRuntimeHints; |
56 | 60 | import org.springframework.boot.SpringApplicationHooks.Hook;
|
57 | 61 | import org.springframework.boot.availability.AvailabilityChangeEvent;
|
58 | 62 | import org.springframework.boot.availability.AvailabilityState;
|
@@ -1301,6 +1305,15 @@ void hookIsCalledAndCanPreventRefreshWhenApplicationIsRun() throws Exception {
|
1301 | 1305 | assertThat(this.context.isRunning()).isFalse();
|
1302 | 1306 | }
|
1303 | 1307 |
|
| 1308 | + @Test |
| 1309 | + void shouldRegisterHints() { |
| 1310 | + RuntimeHints hints = new RuntimeHints(); |
| 1311 | + new SpringApplicationRuntimeHints().registerHints(hints, getClass().getClassLoader()); |
| 1312 | + assertThat(RuntimeHintsPredicates.reflection().onType(SpringApplication.class) |
| 1313 | + .withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_PUBLIC_METHODS)) |
| 1314 | + .accepts(hints); |
| 1315 | + } |
| 1316 | + |
1304 | 1317 | private <S extends AvailabilityState> ArgumentMatcher<ApplicationEvent> isAvailabilityChangeEventWithState(
|
1305 | 1318 | S state) {
|
1306 | 1319 | return (argument) -> (argument instanceof AvailabilityChangeEvent<?>)
|
|
0 commit comments