UnsatisfiedDependencyException: Error creating bean with name

后端 未结 19 966
遇见更好的自我
遇见更好的自我 2020-11-30 01:47

For several days I\'m trying to create Spring CRUD application. I\'m confused. I can\'t solve this errors.

org.springframework.beans.factory.Unsatisfi

19条回答
  •  遥遥无期
    2020-11-30 02:01

    If you describe a field as criteria in method definition ("findBy"), You must pass that parameter to the method, otherwise you will get "Unsatisfied dependency expressed through method parameter" exception.

    public interface ClientRepository extends JpaRepository {
           Client findByClientId();                ////WRONG !!!!
           Client findByClientId(int clientId);    /// CORRECT 
    }
    

    *I assume that your Client entity has clientId attribute.

提交回复
热议问题