你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
yuechen323 - 晨儿哥
赞同来自: tanshaozhi
tongchuan1992 - 学无止境、学以致用
赞同来自:
heheidiot - 90后it女
tanshaozhi
/** * @Description: XXXEsRepositoryImpl * @Author: tsz */ @Repository public class XXXEsRepositoryImpl{ @Value("${elasticsearch.index.sensitive}") private String esIndex; @Value("${elasticsearch.username}") private String esUserName; @Value("${elasticsearch.password}") private String esPassword; @Value("${elasticsearch.host}") private String esHost; @Value("${elasticsearch.port}") private int esPort; @Value("${elasticsearch.connTimeout}") private int connTimeout; @Value("${elasticsearch.socketTimeout}") private int socketTimeout; @Value("${elasticsearch.connectionRequestTimeout}") private int connectionRequestTimeout; private RestHighLevelClient restHighLevelClient; @PostConstruct public void init(){ final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); // 设置密码 credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(esUserName, esPassword)); RestClientBuilder builder = RestClient.builder(new HttpHost(esHost, esPort)).setRequestConfigCallback( requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(connTimeout).setSocketTimeout(socketTimeout) .setConnectionRequestTimeout(connectionRequestTimeout)) .setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider)); this.restHighLevelClient = new RestHighLevelClient(builder); } }
要回复问题请先登录或注册
90后it女
4 个回复
yuechen323 - 晨儿哥
赞同来自: tanshaozhi
tongchuan1992 - 学无止境、学以致用
赞同来自:
heheidiot - 90后it女
赞同来自:
tanshaozhi
赞同来自: