|
| 1 | +package org.springdoc.demo.app4; |
| 2 | + |
| 3 | +import java.util.Arrays; |
| 4 | + |
| 5 | +import org.springdoc.demo.app4.AppNativeConfiguration.AppNativeRuntimeHints; |
| 6 | +import org.springdoc.demo.app4.coffee.CoffeeService; |
| 7 | +import org.springdoc.demo.app4.employee.EmployeeRepository; |
| 8 | + |
| 9 | +import org.springframework.aot.hint.MemberCategory; |
| 10 | +import org.springframework.aot.hint.RuntimeHints; |
| 11 | +import org.springframework.aot.hint.RuntimeHintsRegistrar; |
| 12 | +import org.springframework.context.annotation.Configuration; |
| 13 | +import org.springframework.context.annotation.ImportRuntimeHints; |
| 14 | + |
| 15 | +/** |
| 16 | + * @author bnasslahsen |
| 17 | + */ |
| 18 | +@Configuration |
| 19 | +@ImportRuntimeHints(AppNativeRuntimeHints.class) |
| 20 | +public class AppNativeConfiguration { |
| 21 | + |
| 22 | + static Class[] applicationClasses={org.springdoc.demo.app4.user.User[].class, |
| 23 | + org.springdoc.demo.app4.employee.Employee[].class, |
| 24 | + org.springdoc.demo.app4.coffee.Coffee[].class, |
| 25 | + org.springdoc.demo.app4.coffee.CoffeeOrder[].class, |
| 26 | + EmployeeRepository.class, |
| 27 | + CoffeeService.class |
| 28 | + }; |
| 29 | + |
| 30 | + static class AppNativeRuntimeHints implements RuntimeHintsRegistrar { |
| 31 | + |
| 32 | + @Override |
| 33 | + public void registerHints(RuntimeHints hints, ClassLoader classLoader) { |
| 34 | + Arrays.stream(applicationClasses).forEach(applicationClass -> |
| 35 | + hints.reflection().registerType(applicationClass, |
| 36 | + (hint) -> hint.withMembers(MemberCategory.DECLARED_FIELDS, |
| 37 | + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, |
| 38 | + MemberCategory.INVOKE_DECLARED_METHODS))); |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | +} |
0 commit comments