bygui86 / spring-hateoas

Spring HATEOAS sample project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring HATEOAS sample project

Hypermedia As The Engine Of Application State

Description

This is a really simple example of how to implement RESTful APIs compliant to HATEOAS best practices.


Tech stack

Application

  • Java 8
  • Maven Wrapper 3.x
  • Spring Boot 2.0.x
  • Spring Actuator
  • Spring Data
  • Spring HATEOAS
  • H2 in-memory database
  • Slf4j 1.7.x
  • Lombok 1.18.x

Testing

  • JUnit 4
  • Spring Boot 2.0.x

Build & run

Pre-requisites

No specific pre-requisites

Make

  • just compile

      make clean compile
    
  • build and run unit tests

      make clean build
    
  • install

      make install
    
  • run

      make run
    
  • debug

      make debug
    
  • run integration tests

      make integration-test
    
  • run all tests

      make test
    
  • docker

    • build image

        make docker-build
      
    • run container

        make docker-run
      
    • run container as daemon

        make docker-run-daemon
      
    • stop daemon container

        make docker-stop
      

Maven & Docker

  • just compile

      ./mvnw clean compile
    
  • build and run unit tests

      ./mvnw -Dtest=*UnitTest clean package
    
  • install

      ./mvnw clean install
    
  • run

      ./mvnw spring-boot:run -DskipTests -Dspring-boot.run.jvmArguments='$(MEM_OPTS) $(JMX_OPTS) $(OTHER_OPTS)'
    
  • debug

      ./mvnw spring-boot:run -DskipTests -Dspring-boot.run.jvmArguments='$(MEM_OPTS) $(JMX_OPTS) $(OTHER_OPTS) -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$(IMAGE_DEBUG_PORT)'
    
  • run integration tests

      ./mvnw -Dtest=*IntegrationTest -DfailIfNoTests=false test
    
  • run all tests

      ./mvnw test
    
  • docker

    • build image

        ./mvnw clean package
        docker build -f Dockerfile_local -t $(IMAGE_NAME):$(IMAGE_TAG) .
      
    • run container

        docker run --rm -it --name $(NAME) $(DOCKER_IMAGE_PORTS) --net bridge --add-host=$(DOCKER_HOST):$(DOCKER_IP) $(IMAGE_NAME):$(IMAGE_TAG)
      
    • run container as daemon

        docker run --rm -d --name $(NAME) $(DOCKER_IMAGE_PORTS) --net bridge --add-host=$(DOCKER_HOST):$(DOCKER_IP) $(IMAGE_NAME):$(IMAGE_TAG)
      
    • stop daemon container

        docker container stop -f $(NAME)
      

Links

Theory

https://martinfowler.com/articles/richardsonMaturityModel.html

Techs

DONE
IN-PROG

/

TODO

Issues

Repos

About

Spring HATEOAS sample project

License:Apache License 2.0


Languages

Language:Java 74.6%Language:Makefile 24.0%Language:Dockerfile 1.4%