timtebeek/graphql-jpa-spring-boot-starter


Spring Boot starter for GraphQL JPA; Expose JPA entities with GraphQL.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.timtebeek:graphql-jpa-spring-boot-starter:graphql-jpa-spring-boot-starter-0.0.3'
	}
	dependencies {
		implementation("com.github.timtebeek:graphql-jpa-spring-boot-starter:graphql-jpa-spring-boot-starter-0.0.3")
	}
	<dependency>
	    <groupId>com.github.timtebeek</groupId>
	    <artifactId>graphql-jpa-spring-boot-starter</artifactId>
	    <version>graphql-jpa-spring-boot-starter-0.0.3</version>
	</dependency>

                            
    libraryDependencies += "com.github.timtebeek" % "graphql-jpa-spring-boot-starter" % "graphql-jpa-spring-boot-starter-0.0.3"
        
        

                            
    :dependencies [[com.github.timtebeek/graphql-jpa-spring-boot-starter "graphql-jpa-spring-boot-starter-0.0.3"]]
        
        

Readme


graphql-jpa-spring-boot-starter

Spring Boot starter for GraphQL JPA; Expose JPA entities with GraphQL.

Builds on GraphQL for JPA, which in turn builds on GraphQL Java to expose JPA Entities through a /graphql endpoint.

Many thanks to @jcrygier for the initial hard work; This is mostly just a wrapper.

Usage

  1. Add the following dependency to your project pom.xml along with the repository.

    	<dependencies>
    		<!-- Expose JPA entities using GraphQL -->
    		<dependency>
    			<groupId>com.github.timtebeek</groupId>
    			<artifactId>graphql-jpa-spring-boot-starter</artifactId>
    			<version>0.0.3</version>
    		</dependency>
    	</dependencies>
    ...
    	<repositories>
    		<repository>
    			<id>bintray-timtebeek-maven</id>
    			<name>bintray</name>
    			<url>http://dl.bintray.com/timtebeek/maven</url>
    		</repository>
    	</repositories>
    
  2. Start your project and navigate to http://localhost:8080/graphiql.html.

Warning

This is terribly fun for exploratory projects but quite possibly a terrible idea when you later want to evolve your API. Proceed with caution; maybe read about REST? :)