我正在进行Spring Boot项目的开发。在我的项目中,我有一个仓库文件,但是在仓库类中会显示一个警告信息Unnecessary @Repository
。我正在使用JpaRepository<>
来扩展我的仓库。我的Spring版本是4,JDK版本是17。
以下是我的依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
这是我的代码库
@Repository // Here I get a warning to remove this annotation becasue its unnecessary
public interface CollegeRepo extends JpaRepository<College, Integer>{
}