Skip to content

bygui86/spring-hateoas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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