报的错误:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productRepository' defined in com.example.jingdong.repository.ProductRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.List com.example.jingdong.repository.ProductRepository.findByShop_idAndTypeInOrderByIdDesc(java.lang.Integer,java.util.List)! Reason: Failed to create query for method public abstract java.util.List com.example.jingdong.repository.ProductRepository.findByShop_idAndTypeInOrderByIdDesc(java.lang.Integer,java.util.List)! No property shop found for type Product! Did you mean 'shopId'?; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.example.jingdong.repository.ProductRepository.findByShop_idAndTypeInOrderByIdDesc(java.lang.Integer,java.util.List)! No property shop found for type Product! Did you mean 'shopId'?
ProductRepository.findByShop_idAndTypeInOrderByIdDesc()的查询结果里有shop字段,但是Product实体类里面没有shop属性。
检查一下sql和实体类
findBy xxx 是约定写法,确定一下实际,栏的名字是什么
应该这样写:ProductRepository.findByShopIdAndTypeInOrderByIdDesc,中间不能有下划线