栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

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

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

由于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版本,声明废弃但是还可以使用的

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/390381.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号