1919import org .apache .commons .logging .Log ;
2020import org .apache .commons .logging .LogFactory ;
2121
22+ import org .springframework .aop .SpringProxy ;
23+ import org .springframework .aop .framework .Advised ;
24+ import org .springframework .aot .hint .RuntimeHints ;
25+ import org .springframework .aot .hint .RuntimeHintsRegistrar ;
26+ import org .springframework .aot .hint .TypeReference ;
2227import org .springframework .batch .core .Job ;
2328import org .springframework .batch .core .StepContribution ;
2429import org .springframework .batch .core .job .builder .JobBuilder ;
3035import org .springframework .beans .factory .annotation .Autowired ;
3136import org .springframework .context .annotation .Bean ;
3237import org .springframework .context .annotation .Configuration ;
38+ import org .springframework .context .annotation .ImportRuntimeHints ;
39+ import org .springframework .core .DecoratingProxy ;
3340import org .springframework .transaction .PlatformTransactionManager ;
3441
3542/**
3643 * @author Michael Minella
3744 */
3845@ Configuration (proxyBeanMethods = false )
46+ @ ImportRuntimeHints (JobConfiguration .RuntimeHint .class )
3947public class JobConfiguration {
4048
4149 private static final Log logger = LogFactory .getLog (JobConfiguration .class );
@@ -59,4 +67,14 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon
5967 }, transactionManager ).build ()).build ();
6068 }
6169
70+ static class RuntimeHint implements RuntimeHintsRegistrar {
71+ @ Override
72+ public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
73+ hints .proxies ().registerJdkProxy (builder -> builder
74+ .proxiedInterfaces (TypeReference .of ("org.springframework.batch.core.launch.JobOperator" ))
75+ .proxiedInterfaces (SpringProxy .class , Advised .class , DecoratingProxy .class ));
76+ }
77+
78+ }
79+
6280}
0 commit comments