Creating the right build for the application
A few changes are introduced into the maven pom.xml, generated by Spring Initializr:
⇒ pom.xml
-
Add a few dependency properties
Look for theproperties
element. -
Add a log4j2 starter
Look for the commented section in the POM, under thedependencies
: Log4j2 Starter. -
Add logging, utility and Jackson libraries
Look for the commented sections in the POM, under thedependencies
: Libraries, Jackson and Swagger. -
Add additional testing dependencies
Look for the commented section in the POM, under thedependencies
: Testing.
The lab will focus on building an account CRUD service for a user.
The account contains:
-
accountId (
String
) -
balance (
Double
) -
ownerFirstName (
String
) -
ownerLastName (
String
) -
activeFlag(
Boolean
).
As the course progresses, each lab will aim at creating an outcome, parallel to, the discussed example in this lab account-service.
-
Use one of the earlier mentioned ways to create a Spring Boot project.
-
Use the settings:
-
Project: Maven Project
-
Language: Java
-
Spring Boot: 2.4.3 (or any version in the 2.4 series, as long it is not a SNAPSHOT)
-
-
Project Metadata:
-
Group:
none.training.spring.boot
-
Artifact:
lab
-
Name:
lab
-
Description: Lab for Spring Boot 2.x
-
Package name:
none.training.spring.boot.lab
-
Packaging: Jar
-
Java: 11
-
-
Dependencies (type one at a time, Save, click the button to add the next)
-
Spring Web (Web)
-
Validation (I/O)
-
Spring Data JPA (SQL)
-
-
Download the zip file and extract the contents to the projects directory.
-
For the lab, we will ignore the mvnw and mvnw.cmd files (feel free to delete).
-
Update the lab
pom.xml
to include the dependencies (copy from the todo POM):-
Log4j2 Starter
-
Libraries, Jackson and Swagger
-
Testing
-
-
Save the POM, run a maven clean command (command prompt or within the IDE)
mvn clean
Use this link: Spring Boot Project Creator to download the starter project, then follow from Step 5 above.
Prev | TOC | Next |
---|---|---|