From the course: Creating Spring Boot Microservices
Introduction to Spring Initializr - Spring Boot Tutorial
From the course: Creating Spring Boot Microservices
Introduction to Spring Initializr
- [Instructor] In this chapter, we will see how to create a Spring Boot microservice with Spring Initializr. To build a Java application, the first step is to create a Java project. Most Java projects rely on third-party dependencies, and these dependencies usually have dependencies of their own. On top of that, each version of the dependency rely on other versions. To avoid JAR hell, we use dependency management systems like Maven or Gradle, but even Maven and Gradle have versioning issues between individual JARs that can be a nuisance. Spring Boot recognizes this and creates the notion of a Spring Boot starter which bundles several dependencies into a grouping that's easier to manage. On top of that, starters make automatic configuration decisions at runtime following convention over configuration. There are a lot, and I mean a lot, of Spring Boot starter dependencies, so even cobbling together a project of your own can be difficult. This is where Spring Initializr comes to the rescue. Spring Initializr is a tool for creating Spring Boot Java projects. Initializr creates a package structure, the pom.xml for Maven or build.gradle for Gradle files, and any required Java source classes. For our first Spring Boot microservice, we will employ five Spring Boot starters. Web, which includes Tomcat and Spring MVC, REST Repositories to expose Spring Data repositories over REST, Spring Data JPA to form our object to relational mapping, Lombok, which is a handy library to generate our getters and setters and loggers, and H2, an in-memory database driver. We will start coding our first Spring Boot application with H2 and then later move on to a real persistent relational database. After answering all of the questions in Spring Initializr and selecting the desired dependencies, it generates the project for us.