Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

ctco/spring-boot-graphql-template

Repository files navigation

Build Status

spring-boot-graphql-template

Spring Boot, GraphQL template project with batteries included.

Features

  • Docker 🐳 configuration for production deployment, development and test
    • Remote debugging for development mode

Required Software

  • JDK 1.8
  • Or docker + docker-compose

Lombok

IntelliJ

  • Download and install Lombok plugin
  • Enable Annotation Processors
    • Go to Setting->Build, Execution, Deployment-> Compiler->Annotation Processors
    • Check Enable annotation processing

GraphQL Tools

IntelliJ

  • Download and install GraphQLJs plugin

Style check

IntelliJ

  • You can download "CheckStyle plugin". Then open Settings > Other Settings > Checkstyle. Add path to check-style.xml file and provide link to check-style folder in "${configDir}". This will display errors in editor and it wont affect build/run.

Gradle

  • As default behaviour it is configured to call "checkstyleMain pmdMain" before "build" task is executed, which does not prevent development (application start up and bootrun)

Develop

1.1. Run

  • Gradle: $ gradlew bootRun
  • Docker: $ docker-compose up (or $ docker-compose up --build if image should be rebuilt)

1.2. Debug

Run remote debugger from IDE. Debug port is 5005

Test

  • Gradle: $ gradlew test
  • Docker: $ docker-compose -f docker-compose.test.yml up --build

Build

  • Gradle: $ gradlew buld
  • Docker: $ docker build -t spring-boot-graphql-template .

Run productive

Assuming that the Docker image is already built on the previous step

  • Docker (add -d to run in daemon mode): $ docker run -p 8080:8080 spring-boot-graphql-template

Tech Stack

Packaging

  • Use the Models and Connectors pattern to structure our GraphQL server code, since it is a well established pattern in GraphQL world. Such approach allows to refer to the existing approach instead of coming up with our own set of guidelines.