由于springboot 2.3.0以后版本不支持自动注入JestClient,如下图我们在yml文件中配置JestClient时会出现划掉的线提示。我们采取手动配置的方式
采用手动注入的方式:
@Test
void contextLoads() {
JestClient jestClient = getJestCline();
//List<PmsSkuInfo> pmsSkuInfos= skuService.findAllSkuInfo();
System.out.println("jestClient"+jestClient);
}
public JestClient getJestCline(){
JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig
.Builder("http://10.12.11.100:9200")
.multiThreaded(true)
.build());
return factory.getObject();
}