1. Main technologies
This system adopts the front-end and back-end separation mode. The front-end uses html technology, and the back-end uses spring cloud + mybatis + Maven + security to build the background.
View: It is mainly responsible for the rendering and display of the page, which is realized by html.
Controller: responsible for reading the data of the view presentation layer, controlling the user's input, and calling the method of the business layer, which is realized through the controller.
Model: The object model analysis after requirement analysis is mainly responsible for data management.
2. Project structure directory
3. Hierarchical calling relationship
Four, eureka service center cluster construction
This project has built two service centers, namely: eureka-server, eureka-server-another sub-module
The following explains the construction process of this module:
1. Create a new eureka-server, eureka-server-another module, and import eureka-server dependencies
2. Add the @EnableEurekaServer annotation to the launcher to enable the service
eureka-server:
eureka-server-another:
3. Configure Eureka startup parameters:
(1) Register two Eureka service centers with each other to build a cluster
eureka-server:
eureka-server-another:
Five, Ribbon, Feign polling load balancing strategy
The project currently uses the user-consumer consumer, and combines Ribbon and Feign to implement a round-robin load balancing strategy.
The following is the implementation process of the round robin load balancing strategy:
-
On the basis of the Eureka consumer module, add Ribbon and Feign and import their dependencies.
-
Inject the RestTemplate into the springboot container and mark @LoadBalanced to implement the load balancer. In this way, when requesting a service provider, Ribbon will use the default polling strategy to call the service provider in turn.
-
Add the @FeignClient annotation to the service class in the service layer. In this annotation, the parameter we need to mark has a "value (name)", and the value of value is the name configured by our service provider application.name
-
In the last step, we need the api request path in the service provider above the method, so that we can call the api interface given by the service provider.
Display of six mall functions
Mall display
Add items to the shopping cart
Place an order to buy
Click on the shopping cart and select the items and quantities to be purchased. Click OK to purchase, update the order status, and jump to the My Order page.
The My Order interface displays the order status.
Click on the payment order to settle the unpaid order. There are too many information such as discounted
product settlement
and product background, which are not shown here. If you need it, you can contact.