org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'xxxx':
Unsatisfied dependency expressed through field 'xxRepository';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'xxxRepository':
Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException:
No id property found for class com.xxxx!
当你遇到以上问题时请尝试一下解决方案
启动类添加
@EnableElasticsearchRepositories(basePackages ={"com.xxxx"})
接口处
@Repository 加不加都可以
public interface ZipkinRepository extends ElasticsearchRepository<ZipkinEs,String> {
}
实体类必须加 @Id
@Data
@Document(indexName = "_index",type = "_type")
public class
ZipkinEs {
@Id
private String _id;
@Field(type = FieldType.Text)
private String _score;
private String traceId;
private String duration;
private String localEndpoint;
private Map<String,Object> timestamp;
}
今天的分享就到这里,希望对大家有所帮助
关注 Java有货领取更多资料
联系小编。微信:372787553,带您进群互相学习
左侧小编微信,右侧获取免费资料
技术博客:https://blog.csdn.net/weixin_38937840
免费书籍:https://github.com/Dylan-haiji/Programmer-Learning-materials
SpringCloud学习代码: https://github.com/Dylan-haiji/javayh-cloud
Redis、Mongo、Rabbitmq、Kafka学习代码: https://github.com/Dylan-haiji/javayh-middleware
AlibabaCloud学习代码:https://github.com/Dylan-haiji/javayh-cloud-nacos
SpringBoot+SpringSecurity实现自定义登录学习代码:https://github.com/Dylan-haiji/javayh-distribution