Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack Development with Spring Boot and React

You're reading from   Full Stack Development with Spring Boot and React Build modern and scalable web applications using the power of Java and React

Arrow left icon
Product type Paperback
Published in Apr 2022
Publisher Packt
ISBN-13 9781801816786
Length 378 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Juha Hinkula Juha Hinkula
Author Profile Icon Juha Hinkula
Juha Hinkula
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Part 1: Backend Programming with Spring Boot
2. Chapter 1: Setting Up the Environment and Tools – Backend FREE CHAPTER 3. Chapter 2: Understanding Dependency Injection 4. Chapter 3: Using JPA to Create and Access a Database 5. Chapter 4: Creating a RESTful Web Service with Spring Boot 6. Chapter 5: Securing and Testing Your Backend 7. Part 2: Frontend Programming with React
8. Chapter 6: Setting Up the Environment and Tools – Frontend 9. Chapter 7: Getting Started with React 10. Chapter 8: Consuming the REST API with React 11. Chapter 9: Useful Third-Party Components for React 12. Part 3: Full Stack Development
13. Chapter 10: Setting up the Frontend for Our Spring Boot RESTful Web Service 14. Chapter 11: Adding CRUD Functionalities 15. Chapter 12: Styling the Frontend with React MUI 16. Chapter 13: Testing Your Frontend 17. Chapter 14: Securing Your Application 18. Chapter 15: Deploying Your Application 19. Chapter 16: Best Practices 20. Assessments 21. Other Books You May Enjoy

Understanding Maven

Apache Maven is a software project management tool that makes the software development process simpler and also unifies the development process.

Important Note

You can also use another project management tool called Gradle with Spring Boot, but in this book, we will focus on using Maven.

The basis of Maven is the Project Object Model (POM). The POM is a pom.xml file that contains basic information about a project. There are also all the dependencies that Maven should download to be able to build a project.

Basic information about a particular project can be found at the beginning of the pom.xml file, which defines—for example—the version of the application, the packaging format, and so on. The minimum version of the pom.xml file should contain the following:

  • project root
  • modelVersion
  • groupIdIdentifier (ID) of the project group
  • artifactId—ID of the project (artifact)
  • version—Version of the project (artifact)

Dependencies are defined in the dependencies section, as shown in the following pom.xml code:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
<groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent
             </artifactId>
        <version>2.5.2</version>
        <relativePath/> <!-- lookup parent from  
                 repository -->
    </parent>
    <groupId>com.packt</groupId>
    <artifactId>cardatabase</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>cardatabase</name>
    <description>Demo project for Spring Boot
          </description>
    <properties>
   <java.version>11</java.version>
    </properties>
    <dependencies>
    <dependency>
              
         <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web
                    </artifactId>
        </dependency>
        <dependency>  
          <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools
                    </artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
                
          <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test
                    </artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                
         <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin
                      </artifactId>
            </plugin>
        </plugins>
    </build>
</project>

Maven is normally used from the command line, but Eclipse contains embedded Maven, and that handles all the Maven operations we need. Therefore, we are not focusing on Maven command-line usage here. The most important thing is to understand the structure of the pom.xml file and how to add new dependencies to it. We will learn how to add dependencies using Spring Initializr in the next section. Later in this book, we will also add new dependencies manually to the pom.xml file.

In the next section, we will create our first Spring Boot project and see how we can run it using the Eclipse IDE.

You have been reading a chapter from
Full Stack Development with Spring Boot and React - Third Edition
Published in: Apr 2022
Publisher: Packt
ISBN-13: 9781801816786
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image