commit
a92ed5e2c2
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -49,8 +49,8 @@ class ElasticsearchClientConfigurations {
|
||||||
static class JacksonJsonpMapperConfiguration {
|
static class JacksonJsonpMapperConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
JacksonJsonpMapper jacksonJsonpMapper(ObjectMapper objectMapper) {
|
JacksonJsonpMapper jacksonJsonpMapper() {
|
||||||
return new JacksonJsonpMapper(objectMapper);
|
return new JacksonJsonpMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,6 +23,7 @@ import co.elastic.clients.json.jackson.JacksonJsonpMapper;
|
||||||
import co.elastic.clients.json.jsonb.JsonbJsonpMapper;
|
import co.elastic.clients.json.jsonb.JsonbJsonpMapper;
|
||||||
import co.elastic.clients.transport.ElasticsearchTransport;
|
import co.elastic.clients.transport.ElasticsearchTransport;
|
||||||
import co.elastic.clients.transport.rest_client.RestClientTransport;
|
import co.elastic.clients.transport.rest_client.RestClientTransport;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.elasticsearch.client.RestClient;
|
import org.elasticsearch.client.RestClient;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -108,6 +109,16 @@ class ElasticsearchClientAutoConfigurationTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void jacksonJsonpMapperDoesNotUseGlobalObjectMapper() {
|
||||||
|
this.contextRunner.withConfiguration(AutoConfigurations.of(JacksonAutoConfiguration.class))
|
||||||
|
.withUserConfiguration(RestClientConfiguration.class).run((context) -> {
|
||||||
|
ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
|
||||||
|
JacksonJsonpMapper jacksonJsonpMapper = context.getBean(JacksonJsonpMapper.class);
|
||||||
|
assertThat(jacksonJsonpMapper.objectMapper()).isNotSameAs(objectMapper);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
static class RestClientConfiguration {
|
static class RestClientConfiguration {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue