Project introduction
mall-swarm It is a set of micro Service Mall system , Adopted Spring Cloud Greenwich、Spring Boot 2、MyBatis、Docker、Elasticsearch And so on , At the same time, based on Vue The management background is convenient and fast to build the system .mall-swarm The registration center is integrated on the basis of e-commerce business 、 Configuration center 、 The monitoring center 、 Gateway and other system functions .
System architecture diagram
Organizational structure
-
mall
-
├── mall-common -- Tool class and general code module
-
├── mall-mbg -- MyBatisGenerator Generated database operation code module
-
├── mall-security -- encapsulation SpringSecurity+JWT Security authentication module
-
├── mall-registry -- be based on Eureka The microservice registry of
-
├── mall-config -- be based on Spring Cloud Config Microservice configuration center of
-
├── mall-gateway -- be based on Spring Cloud Gateway The micro service API Gateway service
-
├── mall-monitor -- be based on Spring Boot Admin Microservice monitoring center
-
├── mall-admin -- Background management system services
-
├── mall-search -- be based on Elasticsearch Product search system services
-
├── mall-portal -- Mobile mall system services
-
└── mall-demo -- Microservices call test services remotely
Project address and project tutorial
forward + Focus on , Then private message reply keyword “ Source code ” You can get 《 Project address and project tutorial 》 Free access to .
Technology selection
back-end technology
The front-end technology
Environment building
Development environment construction
mall-swarm Environment used in and mall It's about the same in the project , You can see mall stay Windows Deployment in environment .
Simple environment construction process :
- install IDEA And import project source ;
- install MySql, Create a mall database , And import /document/sql/mall.sql file ;
- install Redis、Elasticsearch、MongoDB、RabbitMQ Such as the environment .
Project deployment
mall-swarm There is a sequence of project start-up , You should start in the following order .
Start the registry mall-registry
- Direct operation com.macro.mall.MallRegistryApplication Of main Function ;
- After running, you can view it through the registry console :http://localhost:8001
Start configuration center mall-config
- Direct operation com.macro.mall.MallConfigApplication Of main Function ;
- Access the following interface to get mall-admin stay dev Configuration information in environment :http://localhost:8301/master/admin-dev.yml
Start the monitoring center mall-monitor
- Direct operation com.macro.mall.MallMonitorApplication Of main Function ;
- After the operation, you can view it through the monitoring center console :http://localhost:8101
- Enter the account and password macro:123456 You can log in to view .
Start the gateway service mall-gateway
- Direct operation com.macro.mall.MallGatewayApplication Of main Function ;
- Access the following interface to get dynamic routing rules :http://localhost:8201/actuator/gateway/routes
Start the background management service mall-admin
- Direct operation com.macro.mall.MallAdminApplication Of main Function ;
- adopt mall-gateway Gateway service provider documentation :http://localhost:8201/mall-admin/swagger-ui.html
- Login interface address :http://localhost:8201/mall-admin/admin/login
- Access the login interface to get token Then put in the authentication header information to access other interfaces that need to be logged in :
Start the front desk service mall-portal
- Direct operation com.macro.mall.portal.MallPortalApplication Of main Function ;
- adopt mall-gateway Gateway service provider documentation :http://localhost:8201/mall-portal/swagger-ui.html
- Login interface address :http://localhost:8201/mall-portal/sso/login
- The interface to be logged in is called in the same way as mall-admin.
Start the search service mall-search
- Direct operation com.macro.mall.search.MallSearchApplication Of main Function ;
- adopt mall-gateway Gateway service provider documentation :http://localh
Start the test service mall-demo
- Direct operation com.macro.mall.MallAdminApplication Of main Function ;
- adopt mall-gateway Gateway service provider documentation :http://localhost:8201/mall-demo/swagger-ui.html
- You can call FeignAdminController、FeignPortalController、FeignSearchController To test the use of Feign The remote call function of .
Effect display
- Registry service information :
Monitoring center service overview information :
- Monitoring center single application details :
Expand the solution
- If you want to use Consul As a registration and configuration center, please refer to :Spring Cloud Consul: Service governance and configuration center
- If you want to use Nacos As a registration and configuration center, please refer to :Spring Cloud Alibaba:Nacos Use as a registry and configuration center
- For distributed transaction solutions, please refer to : Use Seata Thorough solution Spring Cloud Distributed transaction problems in !
- ELK Please refer to :SpringBoot Application Integration ELK Implement log collection