16
16
package org .springframework .batch .core .aot ;
17
17
18
18
import java .sql .Types ;
19
+ import java .time .Duration ;
20
+ import java .time .Instant ;
21
+ import java .time .LocalDate ;
22
+ import java .time .LocalDateTime ;
23
+ import java .time .LocalTime ;
24
+ import java .time .OffsetDateTime ;
25
+ import java .time .OffsetTime ;
26
+ import java .time .Period ;
27
+ import java .time .ZonedDateTime ;
28
+ import java .util .ArrayList ;
29
+ import java .util .Calendar ;
30
+ import java .util .Date ;
19
31
import java .util .HashMap ;
32
+ import java .util .Hashtable ;
33
+ import java .util .Properties ;
34
+ import java .util .UUID ;
35
+ import java .util .stream .Stream ;
20
36
21
37
import org .springframework .aop .SpringProxy ;
22
38
import org .springframework .aop .framework .Advised ;
23
39
import org .springframework .aot .hint .MemberCategory ;
24
40
import org .springframework .aot .hint .RuntimeHints ;
25
41
import org .springframework .aot .hint .RuntimeHintsRegistrar ;
42
+ import org .springframework .aot .hint .SerializationHints ;
26
43
import org .springframework .aot .hint .TypeReference ;
27
44
import org .springframework .batch .core .scope .context .JobContext ;
28
45
import org .springframework .batch .core .scope .context .StepContext ;
@@ -41,6 +58,7 @@ public class CoreRuntimeHints implements RuntimeHintsRegistrar {
41
58
@ Override
42
59
public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
43
60
61
+ // resource hints
44
62
hints .resources ().registerPattern ("org/springframework/batch/core/schema-h2.sql" );
45
63
hints .resources ().registerPattern ("org/springframework/batch/core/schema-derby.sql" );
46
64
hints .resources ().registerPattern ("org/springframework/batch/core/schema-hsqldb.sql" );
@@ -54,6 +72,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
54
72
hints .resources ().registerPattern ("org/springframework/batch/core/schema-sqlserver.sql" );
55
73
hints .resources ().registerPattern ("org/springframework/batch/core/schema-sybase.sql" );
56
74
75
+ // proxy hints
57
76
hints .proxies ()
58
77
.registerJdkProxy (builder -> builder
59
78
.proxiedInterfaces (TypeReference .of ("org.springframework.batch.core.repository.JobRepository" ))
@@ -62,12 +81,18 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
62
81
.proxiedInterfaces (TypeReference .of ("org.springframework.batch.core.explore.JobExplorer" ))
63
82
.proxiedInterfaces (SpringProxy .class , Advised .class , DecoratingProxy .class ));
64
83
84
+ // reflection hints
65
85
hints .reflection ().registerType (Types .class , MemberCategory .DECLARED_FIELDS );
66
-
67
86
hints .reflection ().registerType (JobContext .class , MemberCategory .INVOKE_PUBLIC_METHODS );
68
87
hints .reflection ().registerType (StepContext .class , MemberCategory .INVOKE_PUBLIC_METHODS );
69
88
70
- hints .serialization ().registerType (HashMap .class );
89
+ // serialization hints
90
+ SerializationHints serializationHints = hints .serialization ();
91
+ Stream .of (Number .class , Byte .class , Short .class , Integer .class , Long .class , Double .class , Float .class ,
92
+ Character .class , String .class , Boolean .class , Date .class , Calendar .class , LocalDate .class ,
93
+ LocalTime .class , LocalDateTime .class , OffsetTime .class , OffsetDateTime .class , ZonedDateTime .class ,
94
+ Instant .class , Duration .class , Period .class , HashMap .class , Hashtable .class , ArrayList .class ,
95
+ Properties .class , Exception .class , UUID .class ).forEach (serializationHints ::registerType );
71
96
}
72
97
73
98
}
0 commit comments