Spring Cloud combat e-commerce project mall-swarm address: github.com/macrozheng/…
Abstract
Previously, I updated my mall project to SpringBoot 2.3.0, and the microservice version of mall-swarm has also been updated synchronically. This update completes the project’s Spring Cloud stack, upgrades to Spring Cloud Hoxton and adds Spring Cloud Alibaba, Oauth2 and Knife4j to build Spring Cloud best practices!
System Architecture Diagram
Project organization Structure
Mall ├ ─ ─ mall - common-- Utility classes and common code modules├ ─ ─ mall - MBG-- Database operation code module generated by MyBatisGenerator├ ─ ─ mall - auth-- Unified authentication authority based on Spring Security Oauth2├ ─ ─ mall - gateway-- Microservices API Gateway service based on Spring Cloud Gateway├ ─ ─ mall - monitor-- Spring Boot Admin-based microservice monitoring center├ ─ ─ mall - admin-- Background management system services├ ─ ─ mall - search-- Elasticsearch based product search system service├ ─ ─ mall - portal-- Mobile terminal mall system services├ ─ ─ mall - demo-- Microservice remote call test service└ ─ ─config -- Configure the central storage configuration
Copy the code
Updated Content Overview
- Integrate Spring Cloud Alibaba and change the registration center to Nacos;
- The permission function is changed to Oauth2 to achieve unified authentication and authentication;
- Knife4j integration, gateway aggregation API documents;
- Upgrade Spring Cloud Hoxton.sr5;
- Upgrade Spring Boot 2.3.0.release;
- Update Elasticsearch 7.6.2;
- The ELK log collection function is complete, and logs are collected in different scenarios.
- Windows and Linux deployment documentation updated.
Update Introduction
Spring Cloud Alibaba
Spring Cloud Alibaba was integrated, and the registry and configuration center were switched to Nacos. The registry used before is Eureka, which has entered the maintenance period and will not be updated any more. The configuration center used before is Spring Cloud Config, which requires message queue to realize configuration refresh. Nacos can be used as both the registry and configuration center, using Netty to maintain TCP long connection to achieve configuration refresh, with a convenient management interface, so the use of Nacos instead. The original mall-Registry and mall-config modules have been removed, and the configuration from Nacos is stored in the config folder, which needs to be imported into Nacos when starting the project.
Oauth2
-
The previous project had a module for mall- Security, which I called the security module. All modules that require permission verification rely on it, which is a bit of a toolkit, and it feels like a non-starter when used in microservices.
-
This time, Oauth2 is used instead, and the authentication center mall- Auth is added to achieve unified authentication and authentication, which is more in line with micro-service permission control. For details, please refer to “Micro-service Permission Ultimate Solution, Spring Cloud Gateway + Oauth2 to achieve unified authentication and authentication!” .
-
As there are two different user systems in the project, background users and foreground users, the authentication center also supports multi-user systems. Different user systems can be distinguished by using different client_id and client_secret when accessing the authentication center. Background users use admin-app:123456. The foreground user uses portal-app 123456.
-
The original login interface is compatible with each other, and the Token can still be used by invoking the authentication center internally.
Knife4j
Previously each microservice had its own API document address that needed to be accessed separately. This time, all the API documents of microservices are aggregated on the gateway and the access entrance is unified. You can directly access the API document address of the gateway. For details, please refer to Swagger Document of Microservices Aggregation, This Wave operation is Really sweet! .
Spring Cloud Hoxton.SR5
Spring Cloud and SpringBoot have versions corresponding to each other. Upgrading To SpringBoot 2.3.0 corresponds to this version.
Windows and Linux deployment documentation updated
Due to the upgrade of some components and the change of the project structure, the deployment documentation has also been updated, please refer to the latest documentation for deployment problems!
- Mall-swarm deployment in Windows: www.macrozheng.com/#/deploy/ma…
- Docker Docker: www.macrozheng.com/#/deploy/ma…
other
Other updates are basically the same as the MALL project. For details, refer to “Mall E-commerce Actual Combat Project releases major updates, fully supporting SpringBoot 2.3.0!” .
Running Effect overview
- View registry service information;
- Monitoring center application information;
- API documentation information;
- Logs Collect system information.
- Visual container management;
The project address
So powerful micro service e-commerce actual combat project, quickly point a Star support it!
Github.com/macrozheng/…