您当前的位置: 首页 >  spring

Dongguo丶

暂无认证

  • 2浏览

    0关注

    472博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

springboot 2.3.0以后版本使用JestClient操作es不支持自动注入问题

Dongguo丶 发布时间:2021-10-30 17:20:52 ,浏览量:2

由于springboot 2.3.0以后版本不支持自动注入JestClient,如下图我们在配置文件中配置JestClient时会出现红线提示。我们采取手动配置的方式 在这里插入图片描述

采用手动注入的方式:

@Test
void contextLoads() {
     JestClient jestClient = getJestCline();
     //List 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();
}

当然也可以降低版本 在springboot 2.2.x版本,声明废弃但是还可以使用的 在这里插入图片描述

关注
打赏
1638062488
查看更多评论
立即登录/注册

微信扫码登录

0.0375s