diff --git a/novel-search/src/main/java/io/github/xxyopen/novel/search/config/EsConfig.java b/novel-search/src/main/java/io/github/xxyopen/novel/search/config/EsConfig.java index 1c5dba7..1998dcd 100644 --- a/novel-search/src/main/java/io/github/xxyopen/novel/search/config/EsConfig.java +++ b/novel-search/src/main/java/io/github/xxyopen/novel/search/config/EsConfig.java @@ -6,6 +6,7 @@ import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer; import org.springframework.context.annotation.Bean; 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: * unable to find valid certification path to requested target` */ + @ConditionalOnProperty(value = "spring.elasticsearch.ssl.verification-mode",havingValue = "none") @Bean RestClient elasticsearchRestClient(RestClientBuilder restClientBuilder, ObjectProvider builderCustomizers) { diff --git a/novel-search/src/main/resources/application.yml b/novel-search/src/main/resources/application.yml index 75b5740..2c8d9ad 100644 --- a/novel-search/src/main/resources/application.yml +++ b/novel-search/src/main/resources/application.yml @@ -9,6 +9,8 @@ spring: - https://127.0.0.1:9200 username: elastic password: Fy2JWjJ1hcO2mi1USFLR +# ssl: +# verification-mode: none # XXL-JOB 配置 xxl: