All Projects → chxfantasy → Spring Cloud Demo

chxfantasy / Spring Cloud Demo

This repo is a spring-cloud-demo, can be used for a server backend

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Cloud Demo

Light Reading Cloud
📚 轻松阅读,基于SpringCloud生态开发的阅读类APP微服务实战项目,涉及 SpringCloud-Gateway、Nacos、OpenFeign、Hystrix、Jwt、ElasticSearch 等技术的应用
Stars: ✭ 506 (+69.23%)
Mutual labels:  eureka, spring, spring-cloud
Springcloudlearning
《史上最简单的Spring Cloud教程源码》
Stars: ✭ 16,218 (+5324.08%)
Mutual labels:  eureka, spring, spring-cloud
Eureka Consul Adapter
This project contains a Spring Boot Starter that registers HTTP endpoints on a Spring Cloud Eureka server to support Prometheus's service discovery mechanism for Consul (<consul_sd_config>)
Stars: ✭ 93 (-68.9%)
Mutual labels:  eureka, spring, spring-cloud
Lamp Cloud
lamp-cloud 基于Jdk11 + SpringCloud + SpringBoot的微服务快速开发平台,其中的可配置的SaaS功能尤其闪耀, 具备RBAC功能、网关统一鉴权、Xss防跨站攻击、自动代码生成、多种存储系统、分布式事务、分布式定时任务等多个模块,支持多业务系统并行开发, 支持多服务并行开发,可以作为后端服务的开发脚手架。代码简洁,注释齐全,架构清晰,非常适合学习和企业作为基础框架使用。
Stars: ✭ 4,125 (+1279.6%)
Mutual labels:  eureka, spring, spring-cloud
Jbone
jbone基于Spring Cloud框架开发,旨在为中小企业提供稳定的微服务解决方案,为开发人员提供基础开发骨架,jbone包含微服务中所有常用组件,例如注册中心、服务管理、服务监控、JVM监控、内存分析、调用链跟踪、API网关等等。业务功能包括系统权限的统一管理、单点登录、CMS、电商平台、工作流平台、支付平台等等。
Stars: ✭ 961 (+221.4%)
Mutual labels:  eureka, spring, spring-cloud
Mini Platform
Mini-Platform致力于更简洁易用的轻量级微服务治理平台。
Stars: ✭ 45 (-84.95%)
Mutual labels:  eureka, spring, spring-cloud
Spring Cloud Cli
Spring Cloud CLI features
Stars: ✭ 139 (-53.51%)
Mutual labels:  eureka, spring, spring-cloud
Hiauth
HiAuth是一个开源的基于Oauth2协议的认证、授权系统。
Stars: ✭ 273 (-8.7%)
Mutual labels:  spring, spring-cloud
Advanced Java
😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
Stars: ✭ 59,142 (+19679.93%)
Mutual labels:  eureka, spring-cloud
spring-projects
Some spring sample projects
Stars: ✭ 24 (-91.97%)
Mutual labels:  spring-cloud, eureka
Spring Cloud Gateway Sample
Sample Spring Cloud Gateway Application
Stars: ✭ 268 (-10.37%)
Mutual labels:  spring, spring-cloud
Spring 5 Book
Spring 5 Samples(Spring 5 案例大全/《Spring 5 开发大全》示例源码) covers Spring 5, Spring MVC, Spring WebFlux, Spring Boot and Spring Cloud.
Stars: ✭ 283 (-5.35%)
Mutual labels:  spring, spring-cloud
Springcloudexamples
Spring Cloud 学习教程
Stars: ✭ 208 (-30.43%)
Mutual labels:  eureka, spring-cloud
tictactoe-microservices-example
An example of Spring Cloud Microservices application based on books (see Links section)
Stars: ✭ 23 (-92.31%)
Mutual labels:  spring-cloud, eureka
lua-resty-eureka-client
A Netflix Eureka client for OpenResty/ngx_lua
Stars: ✭ 18 (-93.98%)
Mutual labels:  spring-cloud, eureka
spring-microservices
Example of a microservice architecture using Spring Cloud
Stars: ✭ 76 (-74.58%)
Mutual labels:  spring-cloud, eureka
Springcloud
springCloud学习
Stars: ✭ 251 (-16.05%)
Mutual labels:  eureka, spring-cloud
sample-spring-cloud-gateway
sample spring cloud application with embedded api gateway on spring cloud gateway with or without service discovery with eureka
Stars: ✭ 25 (-91.64%)
Mutual labels:  spring-cloud, eureka
microservices-v8
Learn Microservices with Spring Boot - v8
Stars: ✭ 32 (-89.3%)
Mutual labels:  spring-cloud, eureka
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (-80.94%)
Mutual labels:  spring-cloud, eureka

Introduction

  1. This project is a demo project for spring cloud microservice structure, using spring-boot, including:

    • spring cloud eureka
    • spring cloud config
    • ribbon
    • feign
    • hystrix
    • turbine
    • Spring Cloud Starters
    • multi databases with dynamic select(AOP)
    • Global traceId
    • velocity
    • mybatis, pageHelper (for paging), druid (alibaba druid, for mysql dataSource and connection pool)
    • redis (jdk serialization)
    • slf4j & logback
    • Internationality
    • Global Exception catch
    • Task executor thread pool
    • HealthCheck, globalHealthCheck
  2. This project has a login page. After login, you can see the first page of momentList, add new moments to the list, see the comments of each moment, and add new comments to the comment list.

Run

  1. first of all, you should get a redis started, and a mysql started. Then, the sql for creating databases and dbs is as below:
create database test;

CREATE TABLE `account` (
  `user_id` varchar(127) NOT NULL DEFAULT '',
  `user_name` varchar(127) NOT NULL DEFAULT '',
  `password` varchar(127) NOT NULL DEFAULT '',
  `gmt_created` datetime NOT NULL,
  `gmt_modified` datetime DEFAULT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`),
  KEY `index_user_id` (`user_id`) KEY_BLOCK_SIZE=10
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `moment` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text COLLATE utf8mb4_unicode_ci,
  `gmt_created` datetime NOT NULL,
  `gmt_modified` datetime DEFAULT NULL,
  `is_deleted` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `index_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

create database test2;

CREATE TABLE `comment` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `moment_id` bigint(20) unsigned NOT NULL,
  `content` text COLLATE utf8mb4_unicode_ci,
  `gmt_created` datetime NOT NULL,
  `gmt_modified` datetime DEFAULT NULL,
  `is_deleted` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `index_moment_id` (`moment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  1. Java 8 and maven 3 are required.
  2. run command in order:
	cd spring-cloud-parent
	mvn clean install -DskipTests
	cd ../spring-cloud-client
	mvn clean install -DskipTests
	cd ../spring-cloud-starter
	mvn clean install -DskipTests
	
	cd spring-cloud-eureka
	mvn clean spring-boot:run
	
	cd spring-cloud-account
	mvn clean spring-boot:run
	
	cd spring-cloud-biz
	mvn clean spring-boot:run	
	
	cd spring-cloud-gateway
	mvn clean spring-boot:run
  1. open http://127.0.0.1:7001/index in brower

Code explain

  1. The dependency of this project is shown below :
  2. spring-cloud-parent is just a empty maven project, contains the common poms for other project, so spring-cloud-eureka, spring-cloud-biz, spring-cloud-account and spring-cloud-gateway all inherate from spring-cloud-parent
  3. spring-cloud-starter is a demo starter, it cointains the common beans, common bean configurations for spring-cloud-biz, spring-cloud-account and spring-cloud-gateway.
  4. spring-cloud-client is a common depency for all, contains some util classes and java Models responding to the db table.
  5. spring-cloud-eureka is a server for Service Registration and Service Discovery. Also, I combined spring cloud config with eureka, for dynamic configrations. The heart beat time of eureka is configed to 5s, instead of 15s.
  6. spring-cloud-account is the account module
  7. spring-cloud-biz is the real business module, contains the moment module and comment module, and this project uses two dbs dynamicly.
  8. spring-cloud-gateway is the gateway for all these modules. All outer requests from apps or web pages, should be sent to gateway. GateWay should veirify the login status, do the uploading, do some filters or other aspects.
  9. If you want to stop any of spring-cloud-account, spring-cloud-biz or spring-cloud-gateway, use this command: curl -H 'Accept:application/json' -X POST localhost:7004/shutdown, to stop the heartbeat to the eureka cluster.

Deploy to the production env

  1. These projects should be deployed like this:

中文介绍: http://www.jianshu.com/p/c14c47243994

Any questions, please send to [email protected]

HomePage: http://www.jianshu.com/u/c031bded621b

wx: hurry_words

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].