Building an application with Angular 7, Spring Boot, JPA and MySQL with RESTful Web Services
In this article, we will develop a demo application to demonstrate the usage of Spring Boot, Spring MVC, JPA, MySQL and Angular 7.
Prerequisites
Before proceeding with the application, we need Angular CLI, Spring Tool Suite and MySQL to be installed.
A. Installing angular CLI
Angular Command Line Interface can be installed through npm. Angular CLI is required to generate new angular project, angular components, service and so on.
Download and install node and run the below npm command to install angular CLI
npm install -g @angular/cli
B. Installing Spring Tool Suite
Spring Tool Suite can be download from Spring website. Extract the zip and the run the .exe file to start with STS
C. Installing MySQL
MySQL community edition can be downloaded from MySQL website. Download and install through the .msi/.exe file. Once installed, create a new database using the following commands in MySQL command line/workbench:
// Create a new database named testdb
create database testdb;
// Use this database
use testdb;
Angular
Angular will be used to generate the UI of the demo application. We will use bootstrap to design the page with four components CREATE, UPDATE, DELETE and VIEW options.
Create a new angular application
ng new donors
Installing bootstrap and jQuery:
npm install botstrap jquery — save
(save is prefixed with double hyphens)
Create the components
// Generate Create Component
ng g c create
// Generate Update Component
ng g c update
// Generate Delete Component
ng g c delete
// Generate View Component
ng g c view
Spring Boot
ng g c view