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 | 23 Hours | 13.0 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

1 Source Code
2 Install HTTP client Postman
3 Postman overview
4 Resource and Collection URIs
6 HTTP Headers Accept and Content Type
7 Introduction to Web Service Application Layers
8 A few suggestions

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

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 Implementing Load User By Username
43 Implementing SecurityConstants class
44 Implementing Authentication Filter
45 Trying how user Sign-in works
46 Add public User ID to a Response Header
47 Customize User Authentication URL
48 Implementing Authorization Filter
49 Trying how User Authorization works
50 Making Your REST API Stateless
51 Reading Token Secret from a property file

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
57 Responding with XML or JSON
58 Consuming XML or JSON

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

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

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

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

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

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

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

HATEOAS. Spring Boot v. 2.0.1
111 Important house keeping message
112 Introduction
113 Adding HATEOAS Support to Our Project
114 Adding Links to the AddressRest Model
115 Using the methodOn()
116 Adding Links to a Get Addresses API Call
117 Applying HAL Format

HATEOAS. Spring Boot v. 2.3.0.RELEASE
118 Introduction
119 Adding HATEOAS support to our project
120 Adding Links. Representation Model.
121 Adding Links. Entity Model.
122 Building links with methodOn()
123 Returning a collection of resources with CollectionModel.
124 Adding links to embedded list of addresses

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

Implementing Password Reset Feature
151 Introduction
152 Password Reset Request RestController Method
153 Password Reset Request Service Layer Method
154 Generating Password Reset Token
155 Create PasswordResetTokenEntity & Password Reset Repository
156 Update AmazonSES Class with Code that Sends Email
157 Make the password-reset-request Public
158 Trying How Password Reset Request Works
159 Password Reset HTML Page Add Input fields
160 Password Reset HTML Page Add jQuery
161 Password Reset HTML Page Add the saveNewPassword() function
162 Add Content Type HTTP Header
163 Password Reset RestController Method
164 Password Reset Service Layer Method
165 Making Password Rest URL Public
166 Deploying RESTful Web Service and the Verification Service App
167 Trying How Password Reset Works

Testing Service Layer Code with JUnit 5 & Mockito
168 Introduction to Testing with JUnit & Mockito
169 Test Cases Source Code and Test Libraries Dependency
170 Creating a new JUnit 5 Test Case
171 Mocking Objects with Mockito @Mock
172 JUnit 5 Assertions. Asserting Successful Method Execution.
173 JUnit 5. Expect an Exception with assertThrows()
174 The testCreateUser() method. Mocking Objects.
175 Testing the createUser() Service Method
176 The testCreateUser() method. Adding more code.
177 doNothing(). Exclude Integration Code from Unit Test.
178 Assert an Exception is thrown in the createUser() method

Testing Rest Controller Methods with JUnit 5
179 Create a New Test Case
180 Create Mock Objects and Configure Methods Behaviour
181 Asserting with assertNotNull, assertEquals and assertTrue

JUnit Integration Test. Testing JWT Tokens and UserId
182 Create a new JUnit Integration Test Case
183 Test the Generate UserId Method
184 Test If JWT Token Has Not Expired
185 Test the Expired JWT Token

H2 In-Memory Database
186 What is H2 In-memory Database and Why Using It
187 H2 Database Console Preview
188 Adding Support for the H2 Database
189 Sign in to H2 In-Memory Database
190 Protect the H2 In-Memory Database with a Password
191 API Call to Create a New User and Preview User Details in an In-Memory Database

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

Using Native SQL Queries
213 Introduction. What If You Need to Run SQL Query
214 Native SELECT SQL Query Example
215 JUnit Test to test Native SELECT SQL Query
216 Native SQL Query with Positional Parameters
217 Native SQL Query with Named Parameters
218 Log SQL Queries and Their Values in the Console
219 Using Advanced LIKE Expressions
220 Select Specific Columns from a Table
221 UPDATE SQL Query Example

Using Java Persistence Query Language(JPQL)
222 JPQL Introduction
223 JPQL Select SQL Query
224 JPQL Query to Select Specific Fields Only
225 JPQL Update SQL Query

Cross Origin AJAX HTTP Requests. CORS
226 Do I Need To Enable CORS
227 Send HTTP Request to Reproduce Cross Origin Issue
228 Enable Cross Origin Requests in Rest Controller
229 Global CORS configuration
230 Spring Security Configuration for CORS

My Contact Details
231 My Contact Details

Create Interactive Documentation for your REST API with Swagger
232 Introduction
233 Add Swagger Dependencies
234 Create Swagger Configuration File
235 Enable Swagger URLs and View JSON Documentation
236 View API Documentation In Swagger UI
237 Add Authorization Header
238 Add login endpoint
239 Upading API Documentation Information
240 Web Service Endpoints Additional Information
241 Share Your API with Others
242 Share Swagger UI URL

Spring Security Roles and Authorities
243 Introduction to Roles and Authorities
244 Authentication vs Authorization
245 Database Tables Design
246 User Roles @ManyToMany Mapping for User Entity
247 Create RoleEntity
248 Role Authority @ManyToMany Mapping for the RoleEntity
249 Create AuthorityEntity
250 Create Role Repository
251 Create Authority Repository
252 Creating Initial Roles, Authorities and Admin User
253 Create InitialUsersSetup Class
254 Creating Authorities READ, WRITE, DELETE
255 Creating Roles ROLE ADMIN, ROLE USER
256 Create User with Admin Role
257 Create User Principal Class
258 Update Authentication and Authorization Filters
259 Configure HttpSecurity to Use the ADMIN Role
260 Configure HttpSecurity to Use the DELETE AUTHORITY
261 hasAnyRole() and hasAnyAuthority()
262 Method Level Security Introduction
263 Enable Global Method Security
264 @Secured Annotation Example
265 @PreAuthorize Annotation Example
266 Accessing Principal Object and Method Argument
267 Trying How It Works
268 @PostAuthorize Annotation Example
269 Assign ROLE USER to a Regular User

Next steps
270 What’s next