microservices-platform
基于SpringBoot2.x、SpringCloud和SpringCloudAlibaba并采用前后端分离的企业级微服务多租户系统架构。并引入组件化的思想实现高内聚低耦合,项目代码简洁注释丰富上手容易,适合学习和企业中使用。真正实现了基于RBAC、jwt和oauth2的无状态统一权限认证的解决方案,面向互联网设计同时适合B端和C端用户,支持CI/CD多环境部署,并提供应用管理方便第三方系统接入;同时还集合各种微服务治理功能和监控功能。模块包括:企业级的认证系统、开发平台、应用监控、慢sql监控、统一日志、单点登录、Redis分布式高速缓存、配置中心、分布式任务调度、接口文档、代码生成等等。
Top Related Projects
Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
AWS Service registry for resilient mid-tier load balancing and failover.
Integration with Netflix OSS components
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
SOFABoot is a framework that enhances Spring Boot and fully compatible with it, provides readiness check, class isolation, etc.
Quick Overview
Microservices-platform is a comprehensive cloud-native microservices development platform based on Spring Cloud Alibaba. It provides a complete set of tools and components for building, deploying, and managing microservices architectures. The platform aims to simplify the development process and improve efficiency for enterprise-level applications.
Pros
- Comprehensive solution: Offers a wide range of integrated components and tools for microservices development
- Scalability: Built on Spring Cloud Alibaba, providing excellent scalability for large-scale applications
- Security features: Includes built-in security modules for authentication and authorization
- Monitoring and management: Provides centralized monitoring and management capabilities for microservices
Cons
- Learning curve: May require significant time and effort to fully understand and utilize all features
- Complexity: The extensive feature set might be overwhelming for smaller projects or teams
- Language dependency: Primarily focused on Java-based microservices, which may limit its applicability for polyglot environments
- Documentation: Some parts of the documentation may be in Chinese, potentially creating language barriers for non-Chinese speakers
Code Examples
- Service Registration and Discovery
@SpringBootApplication
@EnableDiscoveryClient
public class UserServiceApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceApplication.class, args);
}
}
This code demonstrates how to enable service registration and discovery using the @EnableDiscoveryClient
annotation.
- Distributed Configuration
spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
file-extension: yaml
This YAML configuration shows how to set up Nacos as the distributed configuration center.
- API Gateway
@SpringBootApplication
@EnableZuulProxy
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}
This example illustrates how to create an API gateway using Zuul proxy.
Getting Started
To get started with microservices-platform:
-
Clone the repository:
git clone https://github.com/zlt2000/microservices-platform.git
-
Build the project:
cd microservices-platform mvn clean package
-
Start the required services (e.g., Nacos, Redis, MySQL) using Docker:
docker-compose up -d
-
Run the microservices:
java -jar user-center/target/user-center.jar java -jar auth-server/target/auth-server.jar java -jar gateway-server/target/gateway-server.jar
-
Access the admin console at
http://localhost:8080
with default credentials (admin/admin).
Competitor Comparisons
Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
Pros of spring-cloud-alibaba
- More comprehensive ecosystem with a wider range of components and services
- Better integration with Alibaba Cloud services
- Larger community support and more frequent updates
Cons of spring-cloud-alibaba
- Steeper learning curve due to its extensive feature set
- Potential vendor lock-in with Alibaba Cloud services
- Less focus on out-of-the-box UI components
Code Comparison
microservices-platform:
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class UserCenterApp {
public static void main(String[] args) {
SpringApplication.run(UserCenterApp.class, args);
}
}
spring-cloud-alibaba:
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ProviderApplication {
public static void main(String[] args) {
SpringApplication.run(ProviderApplication.class, args);
}
}
Both projects use similar annotations for enabling service discovery and Feign clients. The main difference lies in the specific implementations and additional features provided by each framework.
AWS Service registry for resilient mid-tier load balancing and failover.
Pros of Eureka
- Mature and battle-tested service registry used by Netflix at scale
- Simpler to set up and use for basic service discovery needs
- Better documentation and community support due to its widespread adoption
Cons of Eureka
- Limited features compared to microservices-platform's comprehensive suite
- Lacks built-in support for additional microservices patterns and tools
- Requires integration with other Netflix OSS components for advanced functionality
Code Comparison
Eureka client registration:
@SpringBootApplication
@EnableEurekaClient
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
microservices-platform client registration:
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Both projects use similar annotations for service registration, but microservices-platform includes additional features like Feign client support out of the box.
Summary
Eureka is a solid choice for basic service discovery in microservices architectures, offering simplicity and proven reliability. However, microservices-platform provides a more comprehensive solution with additional tools and patterns integrated, making it suitable for more complex microservices ecosystems. The choice between the two depends on the specific requirements and scale of the project.
Integration with Netflix OSS components
Pros of Spring Cloud Netflix
- More mature and widely adopted in the Spring ecosystem
- Extensive documentation and community support
- Seamless integration with other Spring Cloud projects
Cons of Spring Cloud Netflix
- Heavier footprint and potentially slower startup times
- Some components (e.g., Hystrix) are in maintenance mode
- Steeper learning curve for developers new to Spring Cloud
Code Comparison
Spring Cloud Netflix:
@EnableEurekaClient
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Microservices Platform:
@EnableDiscoveryClient
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Both projects use similar annotations for service discovery, with Spring Cloud Netflix using @EnableEurekaClient
and Microservices Platform using @EnableDiscoveryClient
. The main difference lies in the specific implementation and configuration of service discovery and other microservices components.
Spring Cloud Netflix provides a more comprehensive set of tools and integrations within the Spring ecosystem, while Microservices Platform offers a lighter-weight alternative with a focus on simplicity and ease of use for developers building microservices architectures.
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
Pros of Apollo
- More mature and widely adopted project with extensive documentation
- Supports multiple programming languages and frameworks
- Offers a user-friendly web interface for configuration management
Cons of Apollo
- Primarily focused on configuration management, lacking other microservices features
- May require more setup and configuration compared to microservices-platform
- Less integrated with other microservices components
Code Comparison
Apollo configuration example:
Config config = ConfigService.getAppConfig();
String someKey = "someKeyFromApollo";
String value = config.getProperty(someKey, "defaultValue");
microservices-platform configuration example:
@Value("${some.key}")
private String someValue;
@RefreshScope
public class SomeClass {
// Class implementation
}
Summary
Apollo is a robust configuration management system for microservices, while microservices-platform is a more comprehensive solution that includes various components for building microservices architectures. Apollo excels in configuration management across multiple languages, but microservices-platform offers a more integrated approach with additional features like service discovery, API gateway, and monitoring tools. The choice between the two depends on specific project requirements and the desired level of integration within the microservices ecosystem.
:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
Pros of Seata
- More mature and widely adopted distributed transaction solution
- Supports multiple transaction modes (AT, TCC, SAGA, XA)
- Better integration with popular frameworks and cloud-native environments
Cons of Seata
- Focused solely on distributed transactions, not a complete microservices platform
- Steeper learning curve for newcomers to distributed systems
- May require more configuration and setup compared to microservices-platform
Code Comparison
microservices-platform:
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class UserCenterApp {
public static void main(String[] args) {
SpringApplication.run(UserCenterApp.class, args);
}
}
Seata:
@SpringBootApplication
@EnableAutoDataSourceProxy
public class SeataApplication {
public static void main(String[] args) {
SpringApplication.run(SeataApplication.class, args);
}
}
The code snippets show that microservices-platform focuses on service discovery and Feign clients, while Seata emphasizes automatic data source proxying for transaction management. This reflects their different primary purposes: microservices-platform as a comprehensive microservices solution, and Seata as a specialized distributed transaction framework.
SOFABoot is a framework that enhances Spring Boot and fully compatible with it, provides readiness check, class isolation, etc.
Pros of sofa-boot
- More mature and widely adopted in production environments
- Stronger focus on middleware integration and enterprise-level features
- Better documentation and community support
Cons of sofa-boot
- Steeper learning curve due to its comprehensive feature set
- Potentially heavier resource consumption for smaller applications
- Less emphasis on rapid prototyping and quick setup
Code Comparison
sofa-boot:
@SofaService
public class ExampleServiceImpl implements ExampleService {
// Service implementation
}
microservices-platform:
@Service
public class ExampleServiceImpl implements ExampleService {
// Service implementation
}
Key Differences
- sofa-boot uses custom annotations like
@SofaService
for service registration, while microservices-platform relies on standard Spring annotations - sofa-boot provides more extensive middleware integration options out-of-the-box
- microservices-platform offers a more streamlined setup process for rapid development
Use Cases
- sofa-boot: Large-scale enterprise applications with complex middleware requirements
- microservices-platform: Smaller to medium-sized projects prioritizing quick setup and development
Community and Support
- sofa-boot: Larger community, more frequent updates, and extensive documentation
- microservices-platform: Smaller but active community, with a focus on simplicity and ease of use
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
zlt-microservices-platform
å¦ææ¨è§å¾æ帮å©ï¼è¯·ç¹å³ä¸è§ "Star" æ¯æä¸ä¸è°¢è°¢
1. æ»ä½æ¶æå¾
2. åè½ä»ç»
3. 项ç®ä»ç»
- ææ¯äº¤æµç¾¤
- 详ç»å¨çº¿ææ¡£ ï¼https://www.kancloud.cn/zlt2000/microservices-platform/919418
- æ¼ç¤ºç¯å¢å°åï¼ http://zlt2000.cn
- è´¦å·å¯ç ï¼admin/admin
- Grafanaè´¦å·ï¼zlt/zlt123
- æ¼ç¤ºç¯å¢æå ¨æ¹ä½ççæ§ç¤ºä¾ï¼æ¥å¿ç³»ç» + APMç³»ç» + GPEç³»ç»
- Giteeå°åï¼https://gitee.com/zlt2000/microservices-platform
- Githubå°åï¼https://github.com/zlt2000/microservices-platform
- åå端å离çä¼ä¸çº§å¾®æå¡æ¶æ
- 主è¦é对解å³å¾®æå¡åä¸å¡å¼åæ¶å¸¸è§çéåè½æ§éæ±
- åºäº
Spring Authorization Server
深度å®å¶Spring Security
çæ£å®ç°äºåºäºRBAC
ãjwt
åoauth2
çæ ç¶æç»ä¸æé认è¯ç解å³æ¹æ¡ - æä¾åºç¨ç®¡çï¼æ¹ä¾¿ç¬¬ä¸æ¹ç³»ç»æ¥å ¥ï¼æ¯æå¤ç§æ·(åºç¨é离)
- å¼å ¥ç»ä»¶åçææ³å®ç°é«å èä½è¦å并ä¸é«åº¦å¯é ç½®å
- 注é代ç è§èï¼ä¸¥æ ¼æ§å¶å ä¾èµï¼æ¯ä¸ªå·¥ç¨åºæ¬é½æ¯æå°ä¾èµ
- é常éåå¦ä¹ åä¼ä¸ä¸ä½¿ç¨
éæäºå¼æºé¡¹ç®OCP&cpï¼https://gitee.com/owenwangwen/open-capacity-platform
4. åæ¯è¯´æ
åæ¯å | JDK | Spring Boot | Spring Cloud | Spring Security |
---|---|---|---|---|
master | 17 | 3.x | 2022.x | Spring Authorization Server |
5.x | 1.8 | 2.5.x | 2020.x | Spring Security OAuth |
4.x | 1.8 | 2.3.x | 2.2.x | Spring Security OAuth |
5. 模å说æ
central-platform -- ç¶é¡¹ç®ï¼å
Œ
±ä¾èµ
â ââzlt-business -- ä¸å¡æ¨¡åä¸çº§å·¥ç¨
â â ââuser-center -- ç¨æ·ä¸å¿[7000]
â â ââfile-center -- æ件ä¸å¿[5000]
â â ââcode-generator -- 代ç çæå¨[7300]
â â ââsearch-center -- æç´¢ä¸å¿
â â â ââsearch-client -- æç´¢ä¸å¿å®¢æ·ç«¯
â â â ââsearch-server -- æç´¢ä¸å¿æå¡ç«¯[7100]
â ââzlt-commons -- éç¨å·¥å
·ä¸çº§å·¥ç¨
â â ââzlt-auth-client-spring-boot-starter -- å°è£
spring security client端çéç¨æä½é»è¾
â â ââzlt-common-core -- å°è£
éç¨æä½é»è¾
â â ââzlt-common-spring-boot-starter -- å°è£
éç¨æä½é»è¾
â â ââzlt-db-spring-boot-starter -- å°è£
æ°æ®åºéç¨æä½é»è¾
â â ââzlt-log-spring-boot-starter -- å°è£
logéç¨æä½é»è¾
â â ââzlt-redis-spring-boot-starter -- å°è£
Rediséç¨æä½é»è¾
â â ââzlt-loadbalancer-spring-boot-starter -- å°è£
LoadbalanceråFeignçéç¨æä½é»è¾
â â ââzlt-sentinel-spring-boot-starter -- å°è£
Sentinelçéç¨æä½é»è¾
â â ââzlt-elasticsearch-spring-boot-starter -- å°è£
Elasticsearchéç¨æä½é»è¾
â â ââzlt-oss-spring-boot-starter -- å°è£
对象åå¨éç¨æä½é»è¾
â â ââzlt-zookeeper-spring-boot-starter -- å°è£
Zookeeperéç¨æä½é»è¾
â ââzlt-config -- é
ç½®ä¸å¿
â ââzlt-doc -- 项ç®ææ¡£
â ââzlt-gateway -- apiç½å
³ä¸çº§å·¥ç¨
â â ââsc-gateway -- spring-cloud-gateway[9900]
â ââzlt-monitor -- çæ§ä¸çº§å·¥ç¨
â â ââsc-admin -- åºç¨çæ§[6500]
â â ââlog-center -- æ¥å¿ä¸å¿[7200]
â ââzlt-uaa -- spring-security认è¯ä¸å¿[8000]
â ââzlt-register -- 注åä¸å¿Nacos[8848]
â ââzlt-web -- å端ä¸çº§å·¥ç¨
â â ââlayui-web -- layuiå端[8066]
â â ââreact-web -- reactå端[8066]
â ââzlt-demo -- demoä¸çº§å·¥ç¨
â â ââdubbo-demo -- dubboæå¡demo
â â ââresource-server-demo -- èµæºæå¡å¨demo
â â ââseata-demo -- seataåå¸å¼äºå¡demo
â â ââsharding-jdbc-demo -- sharding-jdbcååºå表demo
â â âârocketmq-demo -- rocketmqåmqäºå¡demo
â â ââsso-demo -- åç¹ç»å½demo
â â ââwebsocket-demo -- websocket demo
6. 交æµåé¦
- æé®é¢å çç F&Q ä¸æ没æç¸å ³çåç
- 欢è¿æ交
ISSUS
ï¼è¯·åæ¸ æ¥é®é¢çå ·ä½åå ï¼éç°æ¥éª¤åç¯å¢(ä¸ä¸æ) - 项ç®/å¾®æå¡äº¤æµè¯·è¿ç¾¤ï¼
- ä¸ç¾¤ï¼250883130(已满)
- äºç¾¤ï¼1041797659(已满)
- ä¸ç¾¤ï¼512637767
- 个人å客ï¼http://zlt2000.gitee.io
- 个人é®ç®±ï¼zltdiablo@163.com
- ä¸ªäººå ¬ä¼å·ï¼é¶é¶ææ¯ç¬è®°
- GitChatï¼https://gitbook.cn/gitchat/author/5b2362320398d50d7b7ab29e
7. æªå¾ï¼ç¹å»å¯å¤§å¾é¢è§ï¼
Top Related Projects
Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
AWS Service registry for resilient mid-tier load balancing and failover.
Integration with Netflix OSS components
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
SOFABoot is a framework that enhances Spring Boot and fully compatible with it, provides readiness check, class isolation, etc.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot