创建名称为|的bean时出错通过构造函数参数0表示的不满意的依赖性

时间:2018-02-22 18:34:35

标签: java service spring-data repository javabeans

我想问一下,这个错误有什么问题吗? 我已经与其他实体核对过,他们做得很好。但是,你们可以帮助我解决这个问题吗? Thankyouu

/**
 * @ORM\Entity(repositoryClass="BurgerPriceRepository")
 * @Table(name="bigmac", indexes={@Index(name="product_id", columns={"product_id"})})
 * @Entity
 */
class BigMacPrice extends BurgerPrice
{
    /** @var float @Column(name="sauce", type="decimal", precision=6, scale=2, nullable=false) */
    private $sauce;

    function getBurgerPrice(): float
    {
        //secret sauce price
        return 5 * $this->patty + 3 * $this->bun + $this->sauce;
    }
}

/**
 * @ORM\Entity(repositoryClass="BurgerPriceRepository")
 * @Table(name="mcdouble", indexes={@Index(name="product_id", columns={"product_id"})})
 * @Entity
 */
class McDoublePrice extends BurgerPrice
{
    function getBurgerPrice(): float
    {
        //a different price for mcdouble
        return 2 * $this->patty + 2 * $this->bun;
    }
}

abstract class BurgerPrice
{
    /** @var integer @Column(name="id", type="integer", nullable=false) @Id @GeneratedValue(strategy="IDENTITY") */
    protected $id;

    /** @var integer @Column(name="product_id", type="integer", nullable=false) */
    protected $productId;

    /** @var float @Column(name="patty", type="decimal", precision=6, scale=2, nullable=false) */
    public $patty;

    /** @var float @Column(name="bun", type="decimal", precision=6, scale=2, nullable=false) */
    public $bun;

    /**
     * Computes specific product price for a given burger
     *
     * @return float
     */
    abstract function getBurgerPrice(): float;
}

这是我的代码

Error creating bean with name 'masterVersionServiceImpl' defined in file
Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'masterVersionRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property name found for type MasterVersion!

0 个答案:

没有答案