springrest应用程序中的存储库

springrest应用程序中的存储库,rest,Rest,我有一个简单的问题,我在谷歌上找不到答案:在构建SpringRESTWeb应用程序时,使用@Repository注释存储库可以吗 公共接口UserRepository扩展了JpaRepository,还是此注释不应在REST应用程序中使用?是的,存储库应注释为@repository。我正在使用它,它可以工作:D 我的例子是: @存储库 公共接口RepositoryNote扩展了JpaRepository{ EntityNote FindByUID(UUID UUID); } 关于@Reposi

我有一个简单的问题,我在谷歌上找不到答案:在构建SpringRESTWeb应用程序时,使用@Repository注释存储库可以吗
公共接口UserRepository扩展了JpaRepository,还是此注释不应在REST应用程序中使用?

是的,存储库应注释为
@repository
。我正在使用它,它可以工作:D 我的例子是:

@存储库
公共接口RepositoryNote扩展了JpaRepository{
EntityNote FindByUID(UUID UUID);
}
关于
@Repository
的文档:

Indicates that an annotated class is a "Repository", originally defined by
  Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage,
  retrieval, and search behavior which emulates a collection of objects".