filmov
tv
How to integrate Http Angularjs & Spring Boot

Показать описание
How to integrate Http Angularjs & Spring Boot
$http is an AngularJS service for communication with remote servers. In the article, JavaSampleApproach will guide you how to integrate Http AngularJs and Spring Boot.
Related Article: How to configure AngularJs – SpringBoot
I. Technologies for Http Angularjs and Spring Boot article
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– AngularJS
– BootStrap
II. Overview
1. Project Structure
2. Step to do
– Create SpringBoot project
– Create a simple model
– Create a Controller
– Create a RestController
– Create an angularjs controller with GET & POST methods
– Run & Check result
III. Practices
1. Create SpringBoot project
– Open Spring Tool Suite, on main menu, choose File-New-Spring Starter Project, add project info, then press Next for needed dependencies:
For Template Engines, choose Thymeleaf
For Web MVC, choose Web-Web
2. Create a simple model
3. Create a Controller
4. Create a RestController
Create a RestController with 2 RequestMapping:
– GET request method that returns all customers.
– POST request method that uses for adding a new customer.
6. Create an angularjs controller with GET & POST methods
Create an angular controller file with 2 methods:
– POST method to post a customer’s info to server with url: /postcustomer
– GET method to get all customers from server with url: /getallcustomer
7. Run & Check result
Run Spring Boot Application and check result
Комментарии