Skip to content

Latest commit

 

History

History
104 lines (79 loc) · 3.41 KB

03_MavenDependencies.adoc

File metadata and controls

104 lines (79 loc) · 3.41 KB

Spring Boot - Maven Dependencies

Creating the right build for the application

Spring Boot - Maven

A few changes are introduced into the maven pom.xml, generated by Spring Initializr:
pom.xml

  1. Add a few dependency properties
    Look for the properties element.

  2. Add a log4j2 starter
    Look for the commented section in the POM, under the dependencies : Log4j2 Starter.

  3. Add logging, utility and Jackson libraries
    Look for the commented sections in the POM, under the dependencies : Libraries, Jackson and Swagger.

  4. Add additional testing dependencies
    Look for the commented section in the POM, under the dependencies : Testing.


Overview of the lab domain

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.


Exercise Lab

Lab

  1. Use one of the earlier mentioned ways to create a Spring Boot project.

  2. Use the settings:

    1. Project: Maven Project

    2. Language: Java

    3. Spring Boot: 2.4.3 (or any version in the 2.4 series, as long it is not a SNAPSHOT)

  3. Project Metadata:

    1. Group: none.training.spring.boot

    2. Artifact: lab

    3. Name: lab

    4. Description: Lab for Spring Boot 2.x

    5. Package name: none.training.spring.boot.lab

    6. Packaging: Jar

    7. Java: 11

  4. Dependencies (type one at a time, Save, click the button to add the next)

    1. Spring Web (Web)

    2. Validation (I/O)

    3. Spring Data JPA (SQL)

  5. Download the zip file and extract the contents to the projects directory.

  6. For the lab, we will ignore the mvnw and mvnw.cmd files (feel free to delete).

  7. Update the lab pom.xml to include the dependencies (copy from the todo POM):

    1. Log4j2 Starter

    2. Libraries, Jackson and Swagger

    3. Testing

  8. Save the POM, run a maven clean command (command prompt or within the IDE)
    mvn clean

Confused about creating the project?

Use this link: Spring Boot Project Creator to download the starter project, then follow from Step 5 above.


Prev TOC Next

Overview of the Tutorial Project

TOC

Working with the Model layer