2020import org .springframework .aot .hint .RuntimeHints ;
2121import org .springframework .aot .hint .RuntimeHintsRegistrar ;
2222import org .springframework .lang .Nullable ;
23+ import org .springframework .util .ClassUtils ;
2324
2425/**
2526 * runtime hints for the Elasticsearch client libraries, as these do not provide any of their own.
@@ -34,20 +35,21 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
3435
3536 hints .reflection ()
3637 .registerTypeIfPresent (classLoader , "co.elastic.clients.elasticsearch.indices.IndexSettings" ,
37- builder -> builder .withField ("_DESERIALIZER" )) //
38+ builder -> builder .withField ("_DESERIALIZER" ))
3839 .registerTypeIfPresent (classLoader , "co.elastic.clients.elasticsearch.indices.PutMappingRequest" ,
39- builder -> builder .withField ("_DESERIALIZER" )) //
40+ builder -> builder .withField ("_DESERIALIZER" ))
4041 .registerTypeIfPresent (classLoader , "co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType" ,
41- builder -> builder .withField ("_DESERIALIZER" ))//
42+ builder -> builder .withField ("_DESERIALIZER" ))
4243 .registerTypeIfPresent (classLoader , "co.elastic.clients.elasticsearch._types.mapping.TypeMapping" ,
43- builder -> builder .withField ("_DESERIALIZER" )) //
44- ;
44+ builder -> builder .withField ("_DESERIALIZER" ));
4545
46- hints .serialization () //
47- .registerType (org .apache .http .impl .auth .BasicScheme .class ) //
48- .registerType (org .apache .http .impl .auth .RFC2617Scheme .class ) //
49- .registerType (java .util .HashMap .class ) //
50- ;
46+ if (ClassUtils .isPresent ("org.apache.http.impl.auth.BasicScheme" , classLoader )) {
47+ hints .serialization () //
48+ .registerType (org .apache .http .impl .auth .BasicScheme .class ) //
49+ .registerType (org .apache .http .impl .auth .RFC2617Scheme .class ) //
50+ .registerType (java .util .HashMap .class ) //
51+ ;
52+ }
5153
5254 hints .resources () //
5355 .registerPattern ("co/elastic/clients/version.properties" ) //
0 commit comments