Hands-On Full Stack Development with Spring Boot 2 and React
eBook - ePub

Hands-On Full Stack Development with Spring Boot 2 and React

Build modern and scalable full stack applications using Spring Framework 5 and React with Hooks, 2nd Edition

Juha Hinkula

Share book
  1. 316 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Hands-On Full Stack Development with Spring Boot 2 and React

Build modern and scalable full stack applications using Spring Framework 5 and React with Hooks, 2nd Edition

Juha Hinkula

Book details
Book preview
Table of contents
Citations

About This Book

A comprehensive guide to building full stack applications covering frontend and server-side programming, data management, and web security

Key Features

  • Unleash the power of React Hooks to build interactive and complex user interfaces
  • Build scalable full stack applications designed to meet demands of modern users
  • Understand how the Axios library simplifies CRUD operations

Book Description

React Hooks have changed the way React components are coded. They enable you to write components in a more intuitive way without using classes, which makes your code easier to read and maintain. Building on from the previous edition, this book is updated with React Hooks and the latest changes introduced in create-react-app and Spring Boot 2.1.

This book starts with a brief introduction to Spring Boot. You'll understand how to use dependency injection and work with the data access layer of Spring using Hibernate as the ORM tool. You'll then learn how to build your own RESTful API endpoints for web applications. As you advance, the book introduces you to other Spring components, such as Spring Security to help you secure the backend. Moving on, you'll explore React and its app development environment and components for building your frontend. Finally, you'll create a Docker container for your application by implementing the best practices that underpin professional full stack web development.

By the end of this book, you'll be equipped with all the knowledge you need to build modern full stack applications with Spring Boot for the backend and React for the frontend.

What you will learn

  • Create a RESTful web service with Spring Boot
  • Grasp the fundamentals of dependency injection and how to use it for backend development
  • Discover techniques for securing the backend using Spring Security
  • Understand how to use React for frontend programming
  • Benefit from the Heroku cloud server by deploying your application to it
  • Delve into the techniques for creating unit tests using JUnit
  • Explore the Material UI component library to make more user-friendly user interfaces

Who this book is for

If you are a Java developer familiar with Spring, but are new to building full stack applications, this is the book for you.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Hands-On Full Stack Development with Spring Boot 2 and React an online PDF/ePUB?
Yes, you can access Hands-On Full Stack Development with Spring Boot 2 and React by Juha Hinkula in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in JavaScript. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781838823269
Edition
2

Section 1: Backend Programming with Spring Boot

The reader will be familiar with the basics of Spring Boot. This section focuses on the knowledge and skills required to use databases and create RESTful web services.
This section covers the following chapters:
  • Chapter 1, Setting Up the Environment and Tools – Backend
  • Chapter 2, Dependency Injection
  • Chapter 3, Using JPA to Create and Access a Database
  • Chapter 4, Creating a RESTful Web Service with Spring Boot
  • Chapter 5, Securing and Testing Your Backend

Setting Up the Environment and Tools - Backend

In this chapter, we will set up the environment and tools needed for backend programming with Spring Boot. Spring Boot is a modern Java-based backend framework that makes development faster than traditional Java-based frameworks. With Spring Boot, you can make a standalone web application that has an embedded application server.
In this chapter, we will look into the following topics:
  • Building an environment for Spring Boot development
  • The basics of the Eclipse IDE and Maven
  • Creating and running Spring Boot projects
  • Problem solving when running Spring Boot applications

Technical requirements

The Java SDK, version 8 or higher, is necessary to use the Eclipse IDE. In this book, we are using the Windows operating system, but all tools are available for Linux and macOS as well.
Download the code for this chapter from GitHub: https://github.com/PacktPublishing/Hands-On-Full-Stack-Development-with-Spring-Boot-2-and-React-Second-Edition/tree/master/Chapter01.

Setting up the environment and tools

There are a lot of different integrated development environment (IDE) tools that you can use to develop Spring Boot applications. In this book, we are using Eclipse, which is an open source IDE for multiple programming languages. We will create our first Spring Boot project by using the Spring Initializr project starter page. The project is then imported into Eclipse and executed. Reading the console log is a crucial skill when developing Spring Boot applications.

Installing Eclipse

Eclipse is an open source programming IDE developed by the Eclipse Foundation. An installation package can be downloaded from https://www.eclipse.org/downloads. Eclipse is available for Windows, Linux, and macOS. You should download the latest version of the Eclipse IDE for Java EE developers.
You can either download a ZIP package of Eclipse or an installer package that executes the installation wizard. If using the ZIP package, you just have to extract the package to your local disk and it will contain an executable Eclipse.exe file that you can run by double-clicking on the file.

The basics of Eclipse and Maven

Eclipse is an IDE for multiple programming languages, such as Java, C++, and Python. Eclipse contains different perspectives for your needs. A perspective is a set of views and editors in the Eclipse workbench. The following screenshot shows common perspectives for Java development:
On the left-hand side, we have Project Explorer, where we can see our project structure and resources. Project Explorer is also used to open files by double-clicking on them. The files will be opened in the editor, which is located in the middle of the workbench. The Console view can be found in the lower section of the workbench. The Console view is really important because it shows application logging messages.
You can get Spring Tool Suite (STS) for Eclipse if you want, but we are not going to use it in this book, because the plain Eclipse installation is enough for our purposes. STS is a set of plugins that makes Spring application development simpler (https://spring.io/tools).
Apache Maven is a software project management tool. The basis of Maven is the Project Object Model (POM). Maven makes the software development process simpler and it also unifies the development process. You can also use another project management tool, called Gradle, with Spring Boot, but in this book, we will focus on using Maven.
The POM is a pom.xml file that contains basic information about the project. There are also all the dependencies that Maven should download to be able to build the project.
Basic information about the project can be found at the beginning of the pom.xml file, which defines, for example, the version of the application, packaging format, and so on.
The minimum version of the pom.xml file should contain the project root, modelVersion, groupId, artifactId, and version.
Dependencies are defined in the dependencies section, as follows:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.packt</groupId>
<artifactId>cardatabase</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cardatabase</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</ver...

Table of contents