UserRepository文件
package com.study.repository;
import com.study.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;
@NoRepositoryBean
public interface UserRepository extends JpaRepository {
User findById(long id);
Long deleteById(long id);
}
添加@NoRepositoryBean
注解襟雷,必須使用該注解標(biāo)明刃滓,此接口不是一個Repository Bean 否則就會報上方的錯誤
把@NoRepositoryBean
注釋掉后,應(yīng)把它變成一個Repository Bean
UserRepository extends JpaRepository<User,Long>
package com.study.repository;
import com.study.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
//@NoRepositoryBean
public interface UserRepository extends JpaRepository<User,Long> {
User findById(long id);
Long deleteById(long id);
}