Zhul【烛龙】企业级云原生微服务基础架构,围绕Discovery【探索】框架打造,基于Spring Cloud Discovery服务注册发 现、Ribbon负载均衡、Feign和RestTemplate调用等组件全方位增强的企业级云原生微服务开源解决方案,面向企业级生产需求精雕 细琢,赋能和助力企业快速搭建基础架构的底层云原生微服务框架,有效的降低企业的落地成本。整个架构体系打造,遵循最严格的 Maven对称结构和规范,最严格的命名格式,给予使用者最舒适的使用体验
使用方式是将本项目 clone 到本地,然后执行以下命令:
mvn clean install -DskipTests
执行完毕后,项目将被安装到本地 Maven 仓库。
如果需要使用已发布的版本,在 dependencyManagement
中添加如下配置。
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.zhul.cloud</groupId>
<artifactId>zhul-dependencies</artifactId>
<version>${zhul.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
然后在 dependencies
中添加自己所需使用的依赖即可使用。
① 微服务引入
<dependency>
<groupId>com.zhul.cloud</groupId>
<artifactId>zhul-framework-starter-service</artifactId>
<version>${zhul.version}</version>
</dependency>
② 微应用引入
<dependency>
<groupId>com.zhul.cloud</groupId>
<artifactId>zhul-framework-starter-api</artifactId>
<version>${zhul.version}</version>
</dependency>
③ Spring Cloud Gateway网关引入
<dependency>
<groupId>com.zhul.cloud</groupId>
<artifactId>zhul-framework-starter-gateway</artifactId>
<version>${zhul.version}</version>
</dependency>
下面注解封装了标准Spring Boot、Spring Cloud、服务注册发现等多个注解,可以有效的降低业务使用成本
① 微服务引入
@EnableZhulService
public class ZhulApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(ZhulApplication.class).run(args);
}
}
② 微应用引入
@EnableZhulApplication
public class ZhulApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(ZhulApplication.class).run(args);
}
}
③ Spring Cloud Gateway网关引入
@EnableZhulGateway
public class ZhulApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(ZhulApplication.class).run(args);
}
}
由于大量配置已经内置到框架里,除了服务名和端口号之外,业务层原则上不需要再添加Spring Cloud和中间件其它配置,当然也可 以覆盖掉默认内置的配置。内置配置文件支持Spring标准占位符用法
*小诀窍:为了避免引起业务层的配置无法覆盖掉默认内置的配置,请在bootstrap.properties定义想要覆盖的配置
跟原生的Spring Boot应用程序启动方式一致
为了演示如何使用,Zhul项目包含了一个子模块zhul-examples
。此模块中提供了演示用的 example ,您可以阅读对应的 example 工程下的 readme 文档,根据里面的步骤来体验。
Example 列表:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。