Should have the following items already installed on your machine.
- A Java development kit, a JDK.
- Java 24 or higher JDK for Spring Boot 3.5.0
- Download JDk
- check version installed on windows - java -version
- A Java IDE will be using IntelliJ in the videos, but any java ID will work
- Download IDE (free community edition)
- Sprint Initializer
- Visit offical website of spring boot.
- Inside this website, Select our project specifications,
- Language: Java
- Build tool: Maven
- Stable Version: 3.5.0
- Make sure to update the GitHub code repo every quarter with the latest versions
- Project Meta data
- Group: you microservice name
- Artifact: final outcome of your service
- Java Version
- must be 17 or Higer
- Package Typ
- JAR
- Add Dependencies button
- Define what dependencies we need for our microservices.
- Web (Spring web)
- Since we decided to build REST services by adding these starter project, my spring boot is going to bring all the dependencies and libraries that I need to build web applications, including REST services, MVC based applications, and it is also going to use Apache Tomcat as a default embedded container.
- Storage supporting database (H2 Database)
- H2 database is an internal memory database which you can use inside spring boot web applications. It does not require any installation of MySQL servers or Oracle. You can use this simple internal memory database,
- Supporting framework (Sprint Data JPA)
- Using this starter projects, we can store the data into the database, we can retrieve the data so all the libraries related to database interaction will be available inside the spring data JPA
- Actuator(Spring Boot Actuator)
- Spring Boot provides inbuilt endpoints to monitor and manage our application, such as like health of our application metrics of the application.
- Since we are building microservice and we want to monitor our microservices without writing any external code,
- DevTools (Spring Boot Dev Tools)
- Is a starter project which will improve the productivity of the developer. Like you can see, whenever we have this dependency inside our spring boot application, it is going to provide fast application restarts, live reload and configurations for enhanced development experience.
- Once we start our application, we do some code changes like Java changes, our property changes. In such scenarios, we don't have to manually restart the server of spring boot by default. Internally, this dev tools is going to restart very quickly by reloading only the changes that I have made.
- Lombok
- So using Lombok we can avoid all the setters and getter methods that we need to write inside a pojo class.
- All the data that we get from UI application or from other applications will get converted into a pojo class and to access the data from the Pojo class, we will use setter methods.
- Writing these getter and setter methods is very cumbersome and introduce a lot of boilerplate code. So with the help of Lombok, we can reduce the boilerplate code.
- Validation
- To perform validations on the incoming requests, we need to add these starter project inside our spring boot application.
- IMP: Whatever dependency that I have added related to spring boot dev tools, this will work only for local development.
- Click Generate button to create a Maven Application, and zip it and automaitcally down this setup.
- Extract this code inside a folder backend
- You can see we have the maven structure. There is a source folder, there is a pom.xml and other maven related files.
- Inside this website, Select our project specifications,
- Visit offical website of spring boot.
- A MySQL database in the My SQL workbench
Why Spring boot Backend
- Leveraging spring data rest for RESTful APIs.
- Minimizes the coding for spring boop back end applications.