This is a really simple example of how to implement RESTful APIs compliant to HATEOAS best practices.
- 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
- JUnit 4
- Spring Boot 2.0.x
No specific pre-requisites
-
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
-
-
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)
-
https://martinfowler.com/articles/richardsonMaturityModel.html
- https://www.baeldung.com/spring-hateoas-tutorial
- https://dzone.com/articles/applying-hateoas-to-a-rest-api-with-spring-boot
/