Skip to content

megadotnet/SpringBootDemoApp

Repository files navigation

Spring-Boot Demo Build Status

A Sample application developed with :

  1. Spring Boot 2 REST API
  2. Spring Security
  3. Spring Data JPA
  4. Spring Boot Actuator
  5. Angular JS
  6. Alibaba Druid
  7. Lombok
  8. joda-time

Application is secured with JWT and Spring security.

Feature includes:

  1. Standard login and logout
  2. Registration and email verification
  3. Remember me functionality
  4. Forgot password
  5. Multi-language support
  6. RESTful API

Spring Actuator

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

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

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

H2 Web Console

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.

Testing

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

Run

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

Docker

Setup

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

About

SpringBoot2 Spring Security REST Spring Data Angular JS JWT

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages