The predecessor of the lamp-cloud microservice scaffolding is zuihou-admin-cloud. Starting from 3.0.0, it was renamed lamp-cloud. It is a member of the lamp project.
The lamp-cloud microservice scaffolding is a SaaS microservice scaffolding based on SpringCloud (Hoxton.SR10) + SpringBoot (2.3.10.RELEASE). It has a unified authorization and authentication background management system, which includes user management, resource permission management, gateway Multiple modules such as API, distributed transactions, and large file breakpoint fragmentation resume support the parallel development of multi-business systems and can be used as a development scaffolding for back-end services. The code is concise and the structure is clear, suitable for learning and direct use in projects. The core technology uses major frameworks and middleware such as Nacos, Fegin, Riadfdson, Zuul, Hystrix, JWT Token, Mybatis, SpringBoot, Redis, and RiadfdsitMQ.
lamp-cloud microservice scaffolding function
1. Service registration & discovery and invocation
Service registration and discovery based on Nacos, using Feign to implement service intermodulation, can achieve the same coding experience as calling local methods when using HTTP requests for remote calls. Developers are completely unaware that this is a remote method, and even more It is not perceived that this is an HTTP request.
2. Service authentication:
Use JWT to strengthen the permission verification for scheduling between services and ensure the security of internal services.
3. Load balancing
The rest retained by the service is used for proxy and gateway control. In addition to the commonly used node.js and nginx, the Spring Cloud series' zuul and riadfdson can help us perform normal gateway control and load balancing. Among them, the expansion and reference from foreign projects are based on the JWT Zuul current limiting plug-in, which limits the current.
4. Fusing mechanism
Because of the distribution of services, in order to avoid the "avalanche" of calls between services, Hystrix is used as a fuse to avoid the "avalanche" of calls between services.
5. Monitoring
Use Spring Boot Admin to monitor the running status of each independent Service; use turbine to view the running status and call frequency of the interface in real time; use Zipkin to view the call chain between each service, etc.
6. Link call monitoring
Use Zipkin to realize full-link performance monitoring of microservices, display various indicators from the overall dimension to the local dimension, and centrally display all call chain performance information across applications, which can easily measure overall and local performance, and easily find the source of faults. , which can greatly shorten troubleshooting time in production. With it we can do
Request link tracking and rapid fault location: Error information can be quickly located through the call chain combined with business logs. Visualization: Each stage takes time and performance analysis is performed. Dependency optimization: availability of each call link, sorting out service dependencies and optimizing. Data analysis, link optimization: users’ behavior paths can be obtained, and summary analysis is applied in many business scenarios.
7. Data permissions
Implementing simple data permissions using the DataScopeInterceptor interceptor based on Mybatis
8. SaaS (multi-tenant) non-intrusive solution
Use the Mybatis interceptor to intercept all SQL and modify the default Schema to achieve multi-tenant data isolation. And supports pluggability.
9. Second level cache
J2Cache is used to operate the cache. The first-level cache uses memory (Caffeine) and the second-level cache uses Redis. Since a large number of cache reads will cause the L2 network to become the bottleneck of the entire system, the goal of L1 is to reduce the number of reads to L2. This caching framework is mainly used in cluster environments. It can also be used on a single machine to avoid the impact on the back-end business after the cache cold start caused by application restart.
10. Elegant Bean conversion
Use Dozer components to optimize and convert DTO, DO, PO and other objects
11. Unified form verification on front and back ends
Rigorous form verification usually requires front-end + back-end verification at the same time. However, in traditional projects, the front-end and front-end can only be tested once each. If the rules are changed later, the front-end and back-end must be modified at the same time. Therefore, the starting dependency of zuihou-validator-starter is encapsulated on the basis of hibernate-validator, providing a common interface to obtain the rules that need to be verified. Then the front-end uses the rules returned by the back-end. If the rules change in the future, only the back-end is needed. Just modify it.
12. Prevent cross-site scripting attacks (XSS)
Use filters to filter form parameters in all requests
Filter all application/json type parameters through Json deserializer
13. Currently logged in user information injector
User identity injection through annotations
14. Online API
Since some functions of native swagger-ui are not friendly enough, we adopted the domestic open source swagger-bootstrap-ui and created a stater to facilitate springboot users.
15. Code generator
A set of code generators is customized based on Mybatis-plus-generator. By configuring the annotations of database fields, it automatically generates enumeration classes, data dictionary annotations, SaveDTO, UpdateDTO, form validation rule annotations, Swagger annotations, etc.
16. Scheduler of scheduled tasks
Function enhancements based on xxl-jobs. (For example: sending tasks at a specified time, merging projects with executors and schedulers, multiple data sources)
17. Large file/breakpoint/fragmented resume upload
The front-end uses webupload.js and the back-end uses NIO to implement breakpoint fragmented uploading of large files. After starting the Eureka, Zuul, and File services, you can directly open docs/chunkUploadDemo/demo.html for testing. After testing, the local limit stack maximum memory is 128M to start the File service, and a large file of 4.6G+ can be successfully uploaded within 5 minutes. The official service time will be affected by the user bandwidth and server bandwidth, and it will take a long time.
18. Distributed transactions
Integrated with Alibaba's distributed transaction middleware: seata, it solves the distributed transaction problems faced in microservice scenarios in an efficient and zero-invasive way.
19. Cross-table, cross-database, and cross-service related data automatic injector
It is used to solve the pain of echoing related data of attributes of cross-table, cross-database, cross-service paging data or attributes of a single object. It supports automatic injection of static data attributes (data dictionary) and dynamic primary key data.
20. Grayscale release
In order to solve the problem of frequent service update online, rollback, rapid iteration, and collaborative development within the company, this project uses modified riadfdson's load balancing strategy to achieve grayscale release.
lamp-cloud update log
v3.5.5
refactor
lamp-cloud: Adjust the execution order of TraceFilter to facilitate other filters in the gateway to record log information
lamp-cloud: Optimize RouterMeta and support front-end custom keys
lamp-cloud: Optimize the regional crawling interface crawling data garbled problem
lamp-cloud: Optimizing the regional crawling interface cannot crawl data for counties below the city
lamp-cloud: Added addChildren method to tree structure basic entity
lamp-cloud: Optimize the swagger aggregation structure to ignore the web socket service
fix
lamp-util: When a request header parameter contains Chinese, the asynchronous feign call reports an error
lamp-cloud: Fixed the bug that the tree structure could not obtain the correct splicing hierarchical structure.
lamp-web-plus: Fix bug caused by fixed height of tree page
lamp-web-plus: Solve the problem of the TableAction component Dropdown causing the dividing line to display incorrectly due to permissions
lamp-web-plus: Fixed the issue where data from the list page is transferred to the edit page and the data is accidentally modified.