netootzmz / Spring-Boot-Application-Template

Spring Boot Application Template/Starter-Project

Home Page:https://anantharajuc.github.io/Spring_Boot_Starter_Template/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Boot Application Template/Starter-Project

FOSSA Status

The only thing better than a Maven archetype is a repo you can fork with everything already setup. Skip the documentation and just fork-and-code.

Delete the sample code, replace with your own and you’re good to go.

Built With

  • Maven - Dependency Management
  • Flyway - Version control for database
  • JDK - Java™ Platform, Standard Edition Development Kit
  • Spring Boot - Framework to ease the bootstrapping and development of new Spring Applications
  • MySQL - Open-Source Relational Database Management System
  • git - Free and Open-Source distributed version control system
  • Thymeleaf - Modern server-side Java template engine for both web and standalone environments.
  • Prometheus - Monitoring system and time series database
  • Lombok - Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
  • Swagger - Open-Source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful Web services.

External Tools Used

  • Postman - API Development Environment (Testing Docmentation)

To-Do

  • Logger (Console, File, Mail)
  • RESTful Web Service (CRUD)
  • Bootstrap - CSS
  • Web - HTML, JavaScript (jQuery)
  • Content Negotiation
  • Security (Basic Authentication)
  • Material Design for Bootstrap
  • Docker
  • HATEOS
  • Spring Boot Admin
  • NoSQL (MongoDB)
  • MySQL (Connect to Multiple Schemas)
  • Micrometer
  • Grafna

Running the application locally

There are several ways to run a Spring Boot application on your local machine. One way is to execute the main method in the com.arc.sbtest.SBtemplateApplication class from your IDE.

  • Download the zip or clone the Git repository.
  • Unzip the zip file (if you downloaded one)
  • Open Command Prompt and Change directory (cd) to folder containing pom.xml
  • Open Eclipse
    • File -> Import -> Existing Maven Project -> Navigate to the folder where you unzipped the zip
    • Select the project
  • Choose the Spring Boot Application file (search for @SpringBootApplication)
  • Right Click on the file and Run as Java Application

Alternatively you can use the Spring Boot Maven plugin like so:

mvn spring-boot:run

Security

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>

Spring Boot Starter Security default username is user and a generated security password is printed in the console like Using generated security password: 0423bec1-6759-4ed2-8e3e-e8196effadf9

Automated dependency updates done via Dependabot

Actuator

To monitor and manage your application

URL Method
http://localhost:8080 GET
http://localhost:8080/actuator/ GET
http://localhost:8080/actuator/health GET
http://localhost:8080/actuator/info GET
http://localhost:8080/actuator/prometheus GET
http://localhost:8080/actuator/httptrace GET

URLs

URL Method Remarks
http://localhost:8080/bw/tech-stack GET Custom Response Headers
http://localhost:8080/api/generic-hello GET
http://localhost:8080/api/personalized-hello/ GET
http://localhost:8080/api/personalized-hello?name=spring-boot GET
http://localhost:8080/api/loggers GET

Person URLs

URL Method Remarks
http://localhost:8080/api/person GET Header Accept:application/json or Accept:application/xml for content negotiation
http://localhost:8080/api/person/1 GET

Documentation

Files and Directories

The project (a.k.a. project directory) has a particular directory structure. A representative project is shown below:

.
├── Spring Elements
├── src
│   └── main
│       └── java
│           ├── com.arc.application
│           ├── com.arc.application.config
│           ├── com.arc.application.controller
│           ├── com.arc.application.exception
│           ├── com.arc.application.model
│           ├── com.arc.application.util
│           ├── com.arc.application.repository
│           └── com.arc.application.service
├── src
│   └── main
│       └── resources
│           └── static
│           │   ├── css
│           │   │   └── bootstrap.css
│           │   ├── images
│           │   ├── js
│           │   ├── favicon.ico
│           │   └── index.html
│           ├── templates
│           │   └── view.html
│           ├── application.properties
│           ├── banner.txt
│           └── log4j2.xml
├── src
│   └── test
│       └── java
├── JRE System Library
├── Maven Dependencies
├── bin
├── logs
│   └── application.log
├── src
├── target
│   └──application-0.0.1-SNAPSHOT
├── mvnw
├── mvnw.cmd
├── pom.xml
└── README.md

packages

  • models — to hold our entities;

  • repositories — to communicate with the database;

  • services — to hold our business logic;

  • security — security configuration;

  • controllers — to listen to the client;

  • resources/ - Contains all the static resources, templates and property files.

  • resources/static - contains static resources such as css, js and images.

  • resources/templates - contains server-side templates which are rendered by Spring.

  • resources/application.properties - It contains application-wide properties. Spring reads the properties defined in this file to configure your application. You can define server’s default port, server’s context path, database URLs etc, in this file.

  • test/ - contains unit and integration tests

  • pom.xml - contains all the project dependencies

Reporting Issues

This Project uses GitHub's integrated issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:

Resources

License

FOSSA Status

About

Spring Boot Application Template/Starter-Project

https://anantharajuc.github.io/Spring_Boot_Starter_Template/


Languages

Language:HTML 47.1%Language:Java 38.7%Language:TSQL 12.2%Language:Dockerfile 1.1%Language:CSS 1.0%