A Sample application developed with :
- Spring Boot 2 REST API
- Spring Security
- Spring Data JPA
- Spring Boot Actuator
- Angular JS
- Alibaba Druid
- Lombok
- joda-time
Application is secured with JWT and Spring security.
- Standard login and logout
- Registration and email verification
- Remember me functionality
- Forgot password
- Multi-language support
- RESTful API
Spring Boot includes an Actuator module,which introduces production-ready non-functional requirements to your application. The Spring Boot Actuator module provides monitoring, metrics, and auditing right out of box.
/actuator/metrics
This endpoint shows the metrics information of the current application, where you can determine the how much memory it’s using, how much memory is free, the uptime of your application, the size of the heap is being used, the number of threads used, and so on.
/actuator/health
Displays your application’s health status.
Swagger is the world’s largest framework of API developer tools for the OpenAPI Specification(OAS), enabling development across the entire API lifecycle, from design and documentation, to test and deployment.
Link
http://127.0.0.1:7080/swagger-ui.html
Druid is one of the best database connection pools written in JAVA. The Web console url goes to:
http://127.0.0.1:7080/druid/index.html
By default the console can be accessed at URI http://127.0.0.1:7080/h2-console
which can be changed by spring.h2.console.path property.
JWT http request
User-Agent: Fiddler
Host: 127.0.0.1:7080
Content-Length: 65
content-type: application/json
{"username": "admin", "password": "admin", "rememberMe": "false"}
http response
For local debugging:
mvn spring-boot:run -Dspring.profiles.active=local
For production, it is need config connection string with mysql database first.
mvn spring-boot:run -Dspring.profiles.active=prod
You can specify the base image, entry point, cmd, maintainer and files you want to add to your
image directly in the pom, without needing a separate Dockerfile
.
If you need VOLUME
command(or any other not supported dockerfile command), then you will need
to create a Dockerfile
and use the dockerDirectory
element.
By default the plugin will try to connect to docker on localhost:2375. Set the DOCKER_HOST environment variable to connect elsewhere.
DOCKER_HOST=tcp://<host>:2375
Other docker-standard environment variables are honored too such as TLS and certificates. ###Build docker image and run
mvn clean package dockerfile:build
if you want to skip unit test:
mvn clean package dockerfile:build -DskipTests
or you can build with cli:
docker build --build-arg JAR_FILE=*.jar -t megadotnet/springboot-login-application .
Run with H2 database
docker run -p 7080:7080 -e "SPRING_PROFILES_ACTIVE=local" -m='2g' --name springboot-login-application -d megadotnet/springboot-login-application
remote debugging
docker run -e "JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y" -p 8000:8000 -p 7080:7080 -d megadotnet/springboot-login-application