Make AOT hints for ELC optional.
see also opensearch-project/spring-data-opensearch#441 Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com> (cherry picked from commitffdbea4dba) (cherry picked from commit6b3646bcc1)
This commit is contained in:
committed by
Peter-Josef Meisch
parent
de0eadc72b
commit
270a5e2fca
+9
-9
@@ -15,14 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.client.elc.aot;
|
||||
|
||||
import co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType;
|
||||
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
|
||||
import co.elastic.clients.elasticsearch.indices.IndexSettings;
|
||||
import co.elastic.clients.elasticsearch.indices.PutMappingRequest;
|
||||
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
@@ -37,10 +33,14 @@ public class ElasticsearchClientRuntimeHints implements RuntimeHintsRegistrar {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
|
||||
hints.reflection()
|
||||
.registerType(TypeReference.of(IndexSettings.class), builder -> builder.withField("_DESERIALIZER")) //
|
||||
.registerType(TypeReference.of(PutMappingRequest.class), builder -> builder.withField("_DESERIALIZER")) //
|
||||
.registerType(TypeReference.of(RuntimeFieldType.class), builder -> builder.withField("_DESERIALIZER"))//
|
||||
.registerType(TypeReference.of(TypeMapping.class), builder -> builder.withField("_DESERIALIZER")) //
|
||||
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch.indices.IndexSettings",
|
||||
builder -> builder.withField("_DESERIALIZER")) //
|
||||
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch.indices.PutMappingRequest",
|
||||
builder -> builder.withField("_DESERIALIZER")) //
|
||||
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType",
|
||||
builder -> builder.withField("_DESERIALIZER"))//
|
||||
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch._types.mapping.TypeMapping",
|
||||
builder -> builder.withField("_DESERIALIZER")) //
|
||||
;
|
||||
|
||||
hints.serialization() //
|
||||
|
||||
Reference in New Issue
Block a user