Spring Data GraphQL

The idea is to use spring-data repositories to query GraphQL endpoints.

For the entity:

public class Project {

    private Long id;

    private String name;
    
    //Getters and setters omitted
}

And repository:

public interface ProjectRepository extends GraphQlDataRepository<Project, Long> {

    List<Project> findAllProjects();

    List<Project> findProjectByName(String name);

    List<Project> findByNameAndId(String name, Long id);
}

The following GraphQL queries will be generated by this repository:

{"query":"query { findAllProjects {id name}}"}

{"query":"query { findProjectByName(name:\"NAME\") {id name}}"}

{"query":"query { findByNameAndId(name:\"NAME\", id:\"ID\") {id name}}"}