I am getting this error whenI lauch
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'userRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in xxxxxxx.Repository.UserRepository 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 xxxxx.Model.User xxxxx.Repository.UserRepository.findByEmail(java.lang.String)! Reason: Validation failed for query for method public abstract xxxx.Model.User xxxxx.Repository.UserRepository.findByEmail(java.lang.String)!; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract xxxx.Model.User xxxxx.Repository.UserRepository.findByEmail(java.lang.String)
This is m repository:
public interface UserRepository extends JpaRepository<User, Long> {
@Query("SELECT u FROM User u WHERE u.email = ?1")
public User findByMail(String mail);
}
Whe is rong here?
@Queryassuming the field is namedmailelse rewrite your method tofindByEMail. Please add the full-stracktrace as well as yourUserclass.