
Compare monolithic and microservice architectures, noting advantages and disadvantages for large projects, and see how microservices split apps into independent services with own databases.
Create a closed enrollment app with course listings, purchases, login, admin dashboard, admin and user roles, profile purchases, payouts, using Spring Boot and Spring Cloud microservices with an Angular frontend.
Install IntelliJ community edition for the course, highlighting its ease of use, code completion, and fast learning curve, while noting license options and available TypeScript support and database tools.
Install and configure Lombok in IntelliJ before 2021, and enable annotation processing in settings to bypass boilerplate getter and setter methods for server-side code.
Learn how the Spring @RequestParam annotation extracts query and form parameters from REST API requests. Customize parameter names, mark parameters optional or required, and set default values.
Install PostgreSQL on your system with a simple setup, click next to apply default configurations, set the default postgres user password, and access the PGAdmin console via localhost.
Builds a course microservice architecture with mvc and rest api, enabling course crud operations like list, edit, and delete, secured by Spring Security.
Configure application properties for spring cloud microservices by setting service name, ports, and a PostgreSQL data source with credentials and active schema; enable hibernate settings and disable the Eureka client.
Define a course model as a JPA entity mapped to a database table, with identity id and fields for title, price, and create date, plus column annotations and Lombok.
Master the four primary key generation strategies in Hibernate and JPA: auto, identity, sequence, and table generators, with practical examples and testing guidance.
Create a course repository by extending Spring Data JPA repository to enable basic CRUD operations, auto-generated queries like find by title, and support for pagination, sorting, and custom queries.
Architect the purchase service to model user–course purchases with secure Spring Boot APIs, while implementing an MVC structure, H2 database, Hibernate mapping, and Lombok to reduce boilerplate.
Configure application properties for a microservices setup by customizing the application name and service ports. Configure the H2 in-memory database with data source credentials, driver, dialect, and JPA settings.
Define and wire the purchase controller as a RESTful endpoint in Spring, using @RestController, @RequestMapping, and dependency injection to call the purchase service and return HTTP responses.
Configure security on the purchase microservice by enabling in-memory authentication and web security adapters, disable CSRF, and use properties for username and password with password encoding.
In this course, we will create a project like an online-course-application.
When I say online-course-application, we can think of it like that we will have a product-list page such as book-list, food-list or course-list. Somehow users or customers will see these product-lists and they can buy one of the products. Of course, at the end of it, this transaction will be logged.
Actually, in our application, we will try to implement these processes with different microservices.
To implement this application, we will use five different microservices.
Our microservices will be api-gateway, course-service, purchase-service, eureka-discovery-service and frontend-with-angular.
In api-gateway, we will manage APIs. This microservice will be a gateway for the whole application. To access the other services, we will use this microservice. In this microservice, we will handle user-management also. We will authorize users and if the users are authorized, other services can be available.
In course-service, we will manage course CRUD operations. This service will be a course-management-service.
In purchase-service, we will manage purchase CRUD operations. This service will store the logs coming from the course purchases. For example, the UserX bought the CourseX on DateX etc.
Our other microservice will be eureka discovery service. To provide it we will use spring-cloud-netflix-eureka library.
This microservice allows services to find and communicate with each other without hard coding hostname and port.
With eureka service, other services can register eureka servers and all of them can reach each-other with application name.
These four microservices will be used for server side.
On the client side, we will use Angular to consume all data which come from these microservices. And we will provide a user-friendly UI with angular.
Our microservices dependency process will be like that.
Clients can access the system from the UI. On angular-UI,users can take different actions like creating courses, purchasing courses etc. All requests coming from angular-UI will go to api-gateway. So all traffic will pass over api-gateway.
To access the api-gateway, the client should pass the login process. Then other services will be accessible over the api-gateway.
Spring-security will be one of the main topics in our application. Also, we will use JWT to provide security.
Here, the important point is, we will also use secure connections among microservices. To provide it, we will use secure-key-tokens.
As a database, we will use MySQL, PostgreSQL and H2Database. We will use different databases to show the functionalities of microservices.
We will provide connections between microservices with the OpenFeign library. OpenFeign will handle connection problems in the gateway.
Also, on the backend to provide the connection among all microservices, we will use eureka discovery server. Eureka-discovery-server will be aware of all microservices and it helps to create connections between microservices easily.
In addition to these libraries, In our project, we will use lots of technologies like Spring Boot, Spring Security, Hibernate, MySQL, PostgreSQL, Maven, Lombok, JWT etc.
Of course here, our main library will be Spring-boot. It will provide a simpler and faster way to set up, configure, and run rest API applications.
At the end of each microservices, we will test our applications with Postman. Postman is another amazing tool to debug networking.