Is it possible to use spring-data-rest-webmvc without an actual Repository?

不羁的心 提交于 2019-12-01 13:57:51

I've ended up writing spring-data-custom to create fully customized spring-data repositories, allowing custom code to be used with spring-data-rest etc.

  1. Enable custom repositories (@EnableCustomRepositories)
  2. Annotate eligible entities (@Custom)
  3. Create a repository (extend CustomRepository<T, ID>)
  4. Add custom behavior:
    1. Let repository extend a new interface with the Custom suffix
    2. Create an implementation of the new interface with the Impl prefix
    3. Add one or more CRUD methods named findOne, save, findAll, delete (see DefaultCrudMethods)
    4. Add query methods annotated with @Query
  5. Export repository using spring-data-rest

(copied from README)

As @wwadge correctly mentioned, spring-data-keyvalue is an alternative. Repositories have to implement KeyValueAdapter, e.g. MapKeyValueAdapter.

The easier way is to use spring-data-keyvalue project which does what you are trying to do.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!