网上找的案例是:

实体类字段定义:
private String sku_no;
dao中接口名定义:
Goods findBySkuNo(String skuNo);
spring-data按照接口方法定义的名字(默认认为是驼峰写法)skuNo去实体类查找对应字段,当找不到时,就报错了:
org.springframework.data.mapping.PropertyReferenceException: No property skuNo found for type Goods! Did you mean 'sku_no'?
spring-data规范要求dao中的findBy***,必须和实体字段名称一致,例如findByUdateTime,实体中也要是private String udateTime; 实体字段命名不能是sku_no这种格式,这个不符合驼峰规范。

我项目启动报错No property name found for EsProduct

因为findByNameOrSubTitleOrKeywords接口没有使用也没有注释掉,改了实体类

/**
* 商品ES操作类
* Created by macro on 2018/6/19.
*/
public interface EsProductRepository extends ElasticsearchRepository<EsProduct, Long> {
/**
* 搜索查询
*
* @param name 商品名称
* @param subTitle 商品标题
* @param keywords 商品关键字
* @param page 分页信息
* @return
*/
Page<EsProduct> findByNameOrSubTitleOrKeywords(String name, String subTitle, String keywords,Pageable page);
}
而我的EsProduct实体类中没有name
/**
* 搜索中的商品信息
* Created by macro on 2018/6/19.
*/
@Document(indexName = "pms", type = "product",shards = 1,replicas = 0)
public class EsProduct implements Serializable {
private static final long serialVersionUID = -1L;
@Id
private Long id;
@Field(type = FieldType.Keyword)
private String productSn;
private Long brandId;
@Field(type = FieldType.Keyword)
private String brandName;
private Long productCategoryId;
@Field(analyzer = "ik_max_word",type = FieldType.Text)
private String productName;
@Field(analyzer = "ik_max_word",type = FieldType.Text)
private String subTitle;
private BigDecimal price;
@Field(analyzer = "ik_max_word",type = FieldType.Text)
private String keywords; @Field(type =FieldType.Nested)
private List<EsProductAttribute> attriList; @Field(type =FieldType.Nested)
private EsProductCategory productCategorie;
导致报错

最新文章

  1. Endnote专题之--output style相关问题
  2. TCP\IP三次握手连接,四次握手断开分析
  3. http协议(五)web服务器
  4. CPU cache
  5. Java源码初学_HashSet&amp;LinkedHashSet
  6. UVa 10054 (打印欧拉回路) The Necklace
  7. ural2014 Zhenya moves from parents
  8. jqGrid添加自定义按钮
  9. 36.java_exception_test
  10. Rxjava学习小记
  11. scrapy初试
  12. C++反汇编第五讲,认识多重继承,菱形继承的内存结构,以及反汇编中的表现形式.
  13. php中的echo,json_decode,json_encode常用函数使用注意事项
  14. Latex基础__如何用latex编写矩阵、矩阵等式、方程组、等式左对齐
  15. HybridStart发布v1.0测试版
  16. centos下载
  17. dismiss 多个viewController
  18. CloudSim源代码学习——云数据中心(Datacenter)
  19. 洗礼灵魂,修炼python(31)--面向对象编程(1)—面向对象,对象,类的了解
  20. .NET:C# 如何实现的闭包?

热门文章

  1. Machine Learning Stanford Univerisity (Week 1)
  2. 去除element-ui table表格右侧滚动条的高度
  3. oracle 、mysql 取昨天 前天 本周 数据
  4. 判断pdf文件是否正常可用
  5. IDEA GIT 忽略文件 最佳方式
  6. Optional 理解
  7. hdu 4324
  8. Spring Boot 全局Exception处理
  9. Entity Framewrok Migration 重置
  10. AngularJS视图 ng-view