为了账号安全,请及时绑定邮箱和手机立即绑定

由以下原因引起:org.springframework.data.mapping

由以下原因引起:org.springframework.data.mapping

慕森卡 2022-12-21 13:12:34
我正在研究Spring Data MongoDB 聚合框架。错误:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'aggregationBasicApplication': Unsatisfied dependency expressed through field 'productRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property aggregate found for type Product!    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]Product.java@Documentpublic class Product {    @Id    private final String id;    private final String warehouse;    private final float price;    public Product(String id, String warehouse, float price) {        this.id = id;        this.warehouse = warehouse;        this.price = price;    }    public String getId() {        return id;    }    public String getWarehouse() {        return warehouse;    }    public float getPrice() {        return price;    }}
查看完整描述

1 回答

?
白衣非少年

TA贡献1155条经验 获得超0个赞

花了很多小时后,我没有找到解决办法,为什么薄的东西坏了。我将所有这 3 个类放在同一个包中:xpadro.spring.data.repository. 现在它工作正常。任何人都知道是什么导致了真正的问题?

ProductRepository.java

ProductRepositoryCustom.java

ProductRepositoryImpl.java


查看完整回答
反对 回复 2022-12-21
  • 1 回答
  • 0 关注
  • 104 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号