Spring JPA + PostgreSQL + AngularJS example | Spring Boot

https://ozenero.com/spring-jpa-postgresql-angularjs-example-spring-boot

Spring JPA + PostgreSQL + AngularJS example | Spring Boot

In this tutorial, JavaSampleApproach shows you a Spring Boot example that uses Spring JPA to interact with PostgreSQL and AngularJS as a front-end technology to make request and receive response.

Related Posts:

I. Overview

1. Goal

spring-jpa-postgresql-angularjs-structure

We'll build a Spring Boot Application in that:

  • REST Service provides interface for interacting with Customer Database (PostgreSQL) using Spring JPA.
  • By using AngularJS to make HTTP request to REST Service and receive response, UI can save Customer Data (id, firstName, lastName), retrieves and displays:
  • All Customers in database.
  • Customer Data by customerId.
  • Customers List by lastName.

    2. Technology

  • Java 1.8
  • Maven 3.3.9
  • Spring Tool Suite – Version 3.8.4.RELEASE
  • Spring Boot: 1.5.4.RELEASE

    3. Project Structure

    spring-jpa-postgresql-angularjs-project-structure

Our Application has 2 main parts: REST Service & UI

  • REST Service:
  • Customer Class corresponds to entity and table customer, it should be implemented Serializable.
  • CustomerRepository is an interface extends CrudRepository, will be autowired in CustomerController for implementing repository methods and custom finder methods.
  • CustomerController is a REST Controller which has request mapping methods for RESTful requests such as: /postcustomer, /findall, /customer/{id}, /findByLastName.
  • Configuration for Spring Datasource and Spring JPA properties in application.properties.
  • Response class defines structure for returned data of HTTP GET.
To understand deeply the code about JPA that uses in this example, please visit: How to use Spring JPA with PostgreSQL | Spring Boot
  • UI: uses AngularJS for HTTP POST/GET requests:
  • home.jsp contains elements for POST/GET request and display results.
  • controller() and $http.get()/$http.post() methods in angular.js Javascript file.
  • WebController maps url to home.jsp page.

https://ozenero.com/spring-jpa-postgresql-angularjs-example-spring-boot

Spring JPA + PostgreSQL + AngularJS example | Spring Boot

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

545 bài viết.
98 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 7 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 6 tháng trước
1 0
Bài viết liên quan
White
13 11
Khi các bạn viết sử dụng AngularJS có thấy thắc mắc về phần làm thế nào để mình viết 1 function mà có thể sử dụng cho toàn bộ app của mình không? V...
My Mai viết 6 năm trước
13 11
Male avatar
0 0
https://grokonez.com/springframework/springmvc/consumespringhateoasrestapiusingangularjsexamplespringboot Consume Spring HATEOAS Rest API using An...
loveprogramming viết 2 tháng trước
0 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
545 bài viết.
98 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!