RESTful Web Services, Java, Spring Boot, Spring MVC and JPA

RESTful Web Services, Java, Spring Boot, Spring MVC and JPA
RESTful Web Services, Java, Spring Boot, Spring MVC and JPA
English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 20 Hours | 11.5 GB

Implement API calls: Sign-up, sign-in, email verification, password reset, update, delete. Deploy to Amazon AWS Cloud.

This is a very practical video course aimed at beginner Java developers to help them build their very first RESTful Web Service application with Java, Spring MVC, Spring Boot and Spring Data JPA to implement features like:

  • User sign-up and User sign-in,
  • Email verification,
  • Password Reset,
  • Get user details API call,
  • Get list of users API call and implement Pagination,
  • Update user details and Delete user details API calls,
  • Learn to secure Web Service endpoints with Spring Security,
  • Learn to use Amazon AWS Simple Email Service(SES) to send and request to confirm user email address,
    and learn to generate and include the JSON Web Token in HTTP Request.

Students will learn how to use Postman HTTP client software to send: HTTP POST, GET, DELETE and PUT requests, as well as how to set needed HTTP Headers. We will also cover how to:

  • Send data to your RESTful WebService via HTTP Body and,
  • How to pass data via URL Query String and as a Path parameter,
  • How to enable your RESTful Web Service to respond to Cross Origin AJAX HTTP Requests.

You will also learn how to make your RESTful Web Service accept and respond back with JSON or XML media type.

This video course you will learn how to:

  • Download and install Spring Tool Suite(STS),
  • Download and install MySQL server and MySQL Workbench GUI,
  • Download and run Apache Tomcat,
  • Add a specific Apache Tomcat Version to your Spring Tool Suite,
  • User Maven to build and run your project as well as package it into a deployable WAR file,
  • You will also learn how to run your Web Service as a stand along Java application with build-in Tomcat,
  • Deploy your RESTful Web Service to Apache Tomcat as well as,
  • Start up your own Amazon AWS EC2 Service in Amazon Cloud, install Java, MySQL, Tomcat and deploy RESTful Web Service to your very own cloud server.

This video course also covers the H2 in-memory database and teaches how to build RESTful Web Service that stores data in a database without a need to install MySQL or any other database server. You will also learn how to use H2 console to preview data stored in an in-memory database tables or in a MySQL database server.

When it comes to storing data in a database you will learn how to use Spring Data JPA Query Methods as well as Native SQL Queries.

You will also learn how to use JUnit 5 to test your code and how to use one of the most popular test frameworks called Rest Assured to test RESTful Web Service endpoints of your REST Api.

What you’ll learn

  • Build a RESTful Web Service with Spring MVC and Spring Boot
  • Learn how to implement User Sign-in functionality
  • Learn how to implement User Sign-up functionality
  • Protect RESTful Web Service with Spring Security Framework
  • Learn how to implement Token-Based Authentication
  • Implement Password Reset and Email Verification features
  • Use Spring Data JPA Query Methods
  • Use Spring Data JPA Native SQL Queries
  • Download and Install MySQL Server on Mac
  • Download and Install MySQL Workbench
  • Download and Install Spring Tool Suite
  • Create new project using Spring Tool Suite and Spring Initializer
  • Download, run and stop Apache Tomcat
  • Deploy RESTful Web Service application to Apache Tomcat
  • Run RESTful Web Service application as a stand along Java application
  • Build and run REST API with Maven
  • Use Postman HTTP client to send HTTP Request to a Web Service endpoints
  • Start up Amazon EC2 server
  • Install Java, MySQL and Apache Tomcat on Amazon AWS EC2 server
  • Deploy RESTful Web Service to Amazon AWS EC2 server
  • Use H2 in-memory database
  • Use H2 database console to preview data in memory database as well as in a stand along MySQL database server
  • Use JUnit 5 to test code
  • Use Rest Assured to test RESTful Web Service endpoint
Table of Contents

Introduction
1 Source Code
2 Introduction
3 Install HTTP client Postman
4 Postman overview
5 Resource and Collection URIs
6 HTTP Methods GET, POST, DELETE and PUT
7 HTTP Headers Accept and Content Type
8 Introduction to Web Service Application Layers

Download, Install and run MySQL Database on Local Computer
9 Downloading and Installing MySQL on MAC
10 Start MySQL Server and Login
11 Creating MySQL Database and a new User
12 Downloading and Installing MySQL Workbench
13 Connect to MySQL Database using MySQL WorkBench
14 MySQL WorkBench brief overview

Setup Development Environment
15 Install Java Platform (JDK)
16 Download and Install Spring Tool Suite(STS)

Getting Started. Creating a New Project
17 Create new Spring Boot Project with Spring Tool Suite
18 Creating a new Spring project using Spring Boot Initializr

Quick Start
19 Create Users Rest Controller class
20 Adding Methods to Handle POST, GET, PUT, DELETE HTTP requests
21 Running Web Service Application

Adding MySQL Database Support
22 Update POM.XML file
23 Configure MySQL Database Access Details

Implementing User Sign up
24 Adding method to handle HTTP Post Request
25 Autowire UserRepository into Service class
26 Trying how the User Sign up works
27 Preventing Duplicate Entries with @Column(unique=true)
28 Check if user already exists
29 Generate User Public ID
30 Implementing the Create User Request Model class
31 Implementing Create User Response Model
32 Implementing the UserDto
33 Making use of UserRest and UserDto in RestController
34 Implementing Service class method
35 Implementing UserEntity class
36 Set Default Value for Email Verification Status field
37 Implementing UsersRepository class

Spring Security for User Sign-up
38 Adding Spring Security to our project
39 Encrypt User Password
40 Make the Sign-up Web Service Endpoint Public

Spring Security for User Sign-in
41 Implementing User Sign-in Request Model
42 Making Your REST API Stateless
43 Reading Token Secret from a property file
44 Implementing Load User By Username
45 Implementing SecurityConstants class
46 Implementing Authentication Filter
47 Trying how user Sign-in works
48 Add public User ID to a Response Header
49 Customize User Authentication URL
50 Implementing Authorization Filter
51 Trying how User Authorization works

Implementing Get User Details Web Service Endpoint
52 Get User Details Resource Method
53 Implement Service layer method
54 Update UserRepository
55 Trying the Get User Details API Call

Adding XML Support & JSON Support
56 Update POM.XML, Add XML & JSON Media Types
57 Getting Response in XML or JSON format

Exceptions Handling
58 Introduction
59 Implementing ErrorMessages enum
60 Implementing UserServiceException
61 Handle a Specific Exception
62 Return Custom Error Object Representation
63 Handle All Other Exceptions

Update User Details API Call
64 Update User Details Resource Method
65 Implementing Service Layer Method
66 Trying the Update User Details API Call

Delete User API Call
67 Delete User Resource Method
68 Implementing Service Layer Method
69 Trying the Delete User API Call

Pagination and Get Users API Call
70 The Get Users Request URL
71 The Get Users Resource Method
72 Get Users Service Layer Method
73 Trying the Get Users API Call

Deploying Your App
74 Running Your Web Services App without STS
75 Create Context Path to Your Web Service
76 Run Your App as a Java application
77 Generating WAR file
78 Downloading Apache Tomcat
79 Starting and Stopping Apache Tomcat
80 Creating a new Apache Tomcat User
81 Deploying Your Web Service to Apache Tomcat

Deploying to Amazon Cloud. AWS EC2
82 Startup Your Own Amazon EC2 Linux Server
83 Introduction @OneToOne, @OneToMany, @ManyToOne
84 Connect To Your Server via SSH
85 Update Server Software Packages and Update Java
86 Download & Install Apache Tomcat on AWS EC2 Linux Server
87 Configure Apache Tomcat Users
88 Download and Install MySQL Server on EC2 Linux Server
89 Create Database and Add Database User
90 Deploy Our Web Service App on Apache Tomcat
91 Sending HTTP Request to a WebService Deployed on a Remote Server

Object Relationships @OneToMany Relationship
92 Add List of Addresses to JSON Payload
93 Trying How it Works Creating a new User record
94 Include List of Addresses Into Response
95 Get List of Addresses Web Service Endpoint
96 Get List of Addresses Service Interface
97 Get List of Addresses Service Interface Implementation
98 Get List of Addresses Spring Data JPA Interface
99 Trying How the Get List of Addresses Works
100 API Call to Get a Single Address Details
101 Add List of Addresses to a UserDetailsRequestModel
102 Creating AddressDTO
103 A Better Way of Mapping DTO to an Entity and Entity to a DTO
104 Trying if Deep Objects Mapping Works
105 Create AddressEntity class
106 Add @OneToMany to UserEntity class
107 Generate Public Address Id
108 Updating Service class Java code

HATEOAS
109 Introduction
110 Adding HATEOAS Support to Our Project
111 Adding Adding Links to a Get User Address API Call
112 Using the methodOn()
113 Adding Links to a Get Addresses API Call
114 Applying HAL Format

Implement Email Verification Feature with AWS SES (Simple Email Service)
115 Source Code
116 The verifyEmailToken() RestController Method
117 The verifyEmailToken() Service Layer Function
118 The findUserByEmailVerificationToken() Data Layer Function
119 Checking if Email Verification Token Has Expired
120 Generate and Save the Email Verification Token
121 Prevent Users with Unverified Email Address to Login
122 Trying How it works
123 Create a new Web Project
124 Download Apache Tomcat and Add to Spring STS
125 Creating Email Verification Service Web Page
126 Introduction
127 Reading JavaScript URL Request Parameters
128 The verifyToken() AJAX HTTP Get Request
129 Deploying REST API and Email Verification Service to a Local Tomcat
130 Trying Email Verification Feature on Local Server
131 Adding Code to Send Email
132 Deploying Email Verification to a Remote Amazon EC2 Linux Server
133 Trying Email Verification on Remote Server
134 Verify Email Address with Amazon SES
135 Moving Out of AWS SES Sandbox
136 Submit Support Ticket to Increate Sending Limits
137 Create AWS IAM Access Credentials
138 Creating Shared Credentials File
139 Add AWS Java SDK SES Maven Dependency
140 Spring Security. Make Email Verification a Public Web Service Endpoint.

Implementing Password Reset Feature
141 Introduction
142 Password Reset HTML Page Add jQuery
143 Password Reset HTML Page Add the saveNewPassword() function
144 Add Content Type HTTP Header
145 Password Reset RestController Method
146 Password Reset Service Layer Method
147 Making Password Rest URL Public
148 Deploying RESTful Web Service and the Verification Service App
149 Trying How Password Reset Works
150 Password Reset Request RestController Method
151 Password Reset Request Service Layer Method
152 Generating Password Reset Token
153 Create PasswordResetTokenEntity & Password Reset Repository
154 Update AmazonSES Class with Code that Sends Email
155 Make the password-reset-request Public
156 Trying How Password Reset Request Works
157 Password Reset HTML Page Add Input fields

Testing Service Layer Code with JUnit 5 & Mockito
158 Introduction to Testing with JUnit & Mockito
159 The testCreateUser() method. Adding more code.
160 doNothing(). Exclude Integration Code from Unit Test.
161 Assert an Exception is thrown in the createUser() method
162 Test Cases Source Code and Test Libraries Dependency
163 Creating a new JUnit 5 Test Case
164 Mocking Objects with Mockito @Mock
165 JUnit 5 Assertions. Asserting Successful Method Execution.
166 JUnit 5. Expect an Exception with assertThrows()
167 Run JUnit 5 Test Cases with Maven
168 The testCreateUser() method. Mocking Objects.
169 Testing the createUser() Service Method

Testing Rest Controller Methods with JUnit 5
170 Create a New Test Case
171 Create Mock Objects and Configure Methods Behaviour
172 Asserting with assertNotNull, assertEquals and assertTrue

JUnit Integration Test. Testing JWT Tokens and UserId
173 Create a new JUnit Integration Test Case
174 Test the Generate UserId Method
175 Test If JWT Token Has Not Expired
176 Test the Expired JWT Token

H2 In-Memory Database
177 What is H2 In-memory Database and Why Using It
178 H2 Database Console Preview
179 Adding Support for the H2 Database
180 Sign in to H2 In-Memory Database
181 Protect the H2 In-Memory Database with a Password
182 API Call to Create a New User and Preview User Details in an In-Memory Database

Testing RESTful Web Services with Rest Assured
183 Source code
184 User Login API Call Create Test Class
185 User Login API Call Create Test Method
186 User Login API Call Run Test Method
187 JUnit Test Methods ordering with @FixMethodOrder
188 Get User Details API Call Create Test method
189 Get User Details API Call Validating List of Addresses
190 Get User Details API Call Use the pathParam()
191 Get User Details API Call Running Test Method
192 Update User Details API Call Create Test Method & HTTP Request
193 Update User Details API Call Validating HTTP Response
194 Introduction
195 Delete User Details API Call Create Test Method
196 Delete User Details API Call Run Test Method
197 Creating a new maven project
198 Add support for Rest Assured and JUnit 5 to your project
199 Create User API Call Creating a Test Method
200 Create User API Call Setting Request URL, Context Path and a Port number
201 Create User API Call Create HTTP Post Request and Validate Response
202 Create User API Call Running a Test Case
203 Create User API Call Verify JSON Array with a list of Addresses

Using Native SQL Queries
204 Introduction. What If You Need to Run SQL Query
205 Native SELECT SQL Query Example
206 JUnit Test to test Native SELECT SQL Query
207 Native SQL Query with Positional Parameters
208 Native SQL Query with Named Parameters
209 Log SQL Queries and Their Values in the Console
210 Using Advanced LIKE Expressions
211 Select Specific Columns from a Table
212 UPDATE SQL Query Example

Using Java Persistence Query Language(JPQL)
213 JPQL Introduction
214 JPQL Select SQL Query
215 JPQL Query to Select Specific Fields Only
216 JPQL Update SQL Query

Cross Origin AJAX HTTP Requests. CORS
217 Do I Need To Enable CORS
218 Send HTTP Request to Reproduce Cross Origin Issue
219 Enable Cross Origin Requests in Rest Controller
220 Global CORS configuration
221 Spring Security Configuration for CORS

My Contact Details
222 My Contact Details

Create Interactive Documentation for your REST API with Swagger
223 Introduction
224 Share Your API with Others
225 Share Swagger UI URL
226 Add Swagger Dependencies
227 Create Swagger Configuration File
228 Enable Swagger URLs and View JSON Documentation
229 View API Documentation In Swagger UI
230 Add Authorization Header
231 Add login endpoint
232 Upading API Documentation Information
233 Web Service Endpoints Additional Information