1515 */
1616package org .springframework .batch .core .aot ;
1717
18+ import java .lang .reflect .Method ;
1819import java .sql .Types ;
1920import java .time .Duration ;
2021import java .time .Instant ;
3334import java .util .Hashtable ;
3435import java .util .LinkedHashMap ;
3536import java .util .LinkedHashSet ;
37+ import java .util .List ;
3638import java .util .Properties ;
3739import java .util .Set ;
3840import java .util .UUID ;
4446
4547import org .springframework .aop .SpringProxy ;
4648import org .springframework .aop .framework .Advised ;
49+ import org .springframework .aot .hint .ExecutableMode ;
4750import org .springframework .aot .hint .MemberCategory ;
4851import org .springframework .aot .hint .RuntimeHints ;
4952import org .springframework .aot .hint .RuntimeHintsRegistrar ;
7275import org .springframework .batch .infrastructure .item .Chunk ;
7376import org .springframework .batch .infrastructure .item .ExecutionContext ;
7477import org .springframework .core .DecoratingProxy ;
78+ import org .springframework .util .Assert ;
79+ import org .springframework .util .ReflectionUtils ;
7580
7681/**
7782 * {@link RuntimeHintsRegistrar} for Spring Batch core module.
@@ -131,7 +136,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
131136 .registerJdkProxy (builder -> builder .proxiedInterfaces (TypeReference .of (JobOperator .class ))
132137 .proxiedInterfaces (SpringProxy .class , Advised .class , DecoratingProxy .class ));
133138
134- // reflection hints
139+ // reflection hints: types
135140 hints .reflection ().registerType (Types .class );
136141 hints .reflection ().registerType (JobContext .class );
137142 hints .reflection ().registerType (StepContext .class );
@@ -149,6 +154,15 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
149154 .map (TypeReference ::of )
150155 .forEach (type -> hints .reflection ().registerType (type , MemberCategory .values ()));
151156
157+ // reflection hints: methods
158+ Method jobContextGetJobParametersMethod = ReflectionUtils .findMethod (JobContext .class , "getJobParameters" );
159+ Assert .state (jobContextGetJobParametersMethod != null , "JobContext#getJobParameters must not be null" );
160+ Method stepContextGetJobParametersMethod = ReflectionUtils .findMethod (StepContext .class , "getJobParameters" );
161+ Assert .state (stepContextGetJobParametersMethod != null , "StepContext#getJobParameters must not be null" );
162+
163+ List <Method > methods = List .of (jobContextGetJobParametersMethod , stepContextGetJobParametersMethod );
164+ methods .forEach (method -> hints .reflection ().registerMethod (method , ExecutableMode .INVOKE ));
165+
152166 // serialization hints
153167 SerializationHints serializationHints = hints .serialization ();
154168 Stream .of (LinkedHashSet .class , LinkedHashMap .class , HashSet .class , ReentrantLock .class , ConcurrentHashMap .class ,
0 commit comments