mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-04-27 01:40:50 +00:00
perf: 通过 spring.elasticsearch.ssl.verification-mode
配置项设置 ssl 的认证模式
none:不认证,信任所有的证书
This commit is contained in:
parent
58b0666214
commit
35c750d4ac
@ -6,6 +6,7 @@ import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
|
|||||||
import org.elasticsearch.client.RestClient;
|
import org.elasticsearch.client.RestClient;
|
||||||
import org.elasticsearch.client.RestClientBuilder;
|
import org.elasticsearch.client.RestClientBuilder;
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer;
|
import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -40,6 +41,7 @@ public class EsConfig {
|
|||||||
* fix `sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
|
* fix `sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
|
||||||
* unable to find valid certification path to requested target`
|
* unable to find valid certification path to requested target`
|
||||||
*/
|
*/
|
||||||
|
@ConditionalOnProperty(value = "spring.elasticsearch.ssl.verification-mode",havingValue = "none")
|
||||||
@Bean
|
@Bean
|
||||||
RestClient elasticsearchRestClient(RestClientBuilder restClientBuilder,
|
RestClient elasticsearchRestClient(RestClientBuilder restClientBuilder,
|
||||||
ObjectProvider<RestClientBuilderCustomizer> builderCustomizers) {
|
ObjectProvider<RestClientBuilderCustomizer> builderCustomizers) {
|
||||||
|
@ -9,6 +9,8 @@ spring:
|
|||||||
- https://127.0.0.1:9200
|
- https://127.0.0.1:9200
|
||||||
username: elastic
|
username: elastic
|
||||||
password: Fy2JWjJ1hcO2mi1USFLR
|
password: Fy2JWjJ1hcO2mi1USFLR
|
||||||
|
# ssl:
|
||||||
|
# verification-mode: none
|
||||||
|
|
||||||
# XXL-JOB 配置
|
# XXL-JOB 配置
|
||||||
xxl:
|
xxl:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user