详细报错信息:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'elasticsearchTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [spring-es.xml]: Cannot resolve reference to bean 'client' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client': Invocation of init method failed; nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]错误原因
解决方案 | 1 若为Jetty启动 参考下图Spring 的netty和ElasticSearch的netty相关jar包冲突。因此程序启动失败,抛出异常
在Runner--VM Options中添加如下代码即可
-Des.set.netty.runtime.available.processors=false| 2 在SpringBoot的入口类Application的main方法中添加如下代码即可
System.setProperty("es.set.netty.runtime.available.processors", "false");
部分报错信息图示:
Thanks


![【Error】Spring整合ElasticSearch启动项目报错:availableProcessors is already set to [8], rejecting [8] 【Error】Spring整合ElasticSearch启动项目报错:availableProcessors is already set to [8], rejecting [8]](http://www.mshxw.com/aiimages/31/682392.png)
