spring-projects / spring-projects/spring-data-rest

Improvment suggestion: Better support for read only repositories

Open
#79 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Although it is possible to disable the CUD parts of the CRUDRepsoitory by adding @exported(false) to overloaded methods of the CRUDRepository i think it would be nicer to see either:

The Introduction to a read only repository in the spring-data-commons ie:

@NoRepositoryBean
public interface ReadOnlyRepository<T, ID extends Serializable> extends Repository<T, ID> {
    T findOne(ID id);
    List<T> findAll();
    List<T> findAll(Sort sort);
    Page<T> findAll(Pageable pageable);
}

Which can be used as the decoration point when using spring-data-rest-webmvc instead of CRUDRepository (although I imagine a CRUDRepository would inherit from such a class)

or

Have the spring-data-rest-webmvc decorate any Repository based interface and follow some sort of expected method signatures for providing the appropriate Get/Put/Post/Patch/Delete REST operations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review CRUDRepository and spring-data-rest-webmvc, then compare the proposed ReadOnlyRepository interface with the alternative of decorating generic Repository interfaces. Done requires a decided API direction and documented method/HTTP-operation behavior; the issue does not identify files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.