🎉 3.3.0.RELEASE 升级适配SpringCloud 2021

This commit is contained in:
smallchill 2022-03-28 15:55:49 +08:00
parent 5914f6c133
commit 4d2e706fcb
32 changed files with 154 additions and 85 deletions

View File

@ -1,9 +1,9 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V3.2.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Release-V3.3.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-2020-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.6-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Spring%20Cloud-2021-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.6.3-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a>
@ -22,7 +22,7 @@
* 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。
* 借鉴OAuth2实现了多终端认证系统可控制子系统的token权限互相隔离。
* 借鉴Security封装了Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。
* 稳定生产了三年,经历了从 Camden -> Hoxton -> 2020 的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
* 稳定生产了三年,经历了从 Camden -> Hoxton -> 2021 的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图

View File

@ -8,7 +8,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<artifactId>blade-auth</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -17,6 +17,7 @@ package org.springblade.common.launch;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.launch.service.LauncherService;
import org.springblade.core.launch.utils.PropsUtil;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
@ -31,10 +32,10 @@ public class LauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
props.setProperty("spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.server-addr", LauncherConstant.nacosAddr(profile));
PropsUtil.setProperty(props, "spring.cloud.nacos.config.server-addr", LauncherConstant.nacosAddr(profile));
PropsUtil.setProperty(props, "spring.cloud.sentinel.transport.dashboard", LauncherConstant.sentinelAddr(profile));
PropsUtil.setProperty(props, "spring.zipkin.base-url", LauncherConstant.zipkinAddr(profile));
}
}

View File

@ -0,0 +1,42 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.common.tool;
import org.springframework.util.StringUtils;
import java.util.Properties;
/**
* 配置工具类
*
* @author Chill
*/
public class PropsUtil {
/**
* 设置配置值已存在则跳过
*
* @param props property
* @param key key
* @param value value
*/
public static void setProperty(Properties props, String key, String value) {
if (StringUtils.isEmpty(props.getProperty(key))) {
props.setProperty(key, value);
}
}
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -17,8 +17,8 @@ package $!{package.Controller};
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
@ -35,14 +35,15 @@ import $!{package.Entity}.$!{entity};
#set($voPackage=$package.Entity.replace("entity","vo"))
import $!{voPackage}.$!{entity}VO;
#set($wrapperPackage=$package.Entity.replace("entity","wrapper"))
#if($!{cfg.hasWrapper})
import $!{wrapperPackage}.$!{entity}Wrapper;
#end
import $!{package.Service}.$!{table.serviceName};
#if($!{superControllerClassPackage})
import $!{superControllerClassPackage};
#end
#if(!$!{superEntityClass})
#end
import java.util.List;
/**
* $!{table.comment} 控制器
@ -52,7 +53,7 @@ import java.util.List;
*/
@RestController
@AllArgsConstructor
@RequestMapping("#if($!{package.ModuleName})/$!{package.ModuleName}#end/$!{cfg.entityKey}")
@RequestMapping("#if($!{package.ModuleName})$!{package.ModuleName}#end/$!{entityKey}")
@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口")
#if($!{superControllerClass})
public class $!{table.controllerName} extends $!{superControllerClass} {
@ -62,6 +63,7 @@ public class $!{table.controllerName} {
private $!{table.serviceName} $!{table.entityPath}Service;
#if($!{cfg.hasWrapper})
/**
* 详情
*/
@ -84,6 +86,30 @@ public class $!{table.controllerName} {
return R.data($!{entity}Wrapper.build().pageVO(pages));
}
#else
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入$!{table.entityPath}")
public R<$!{entity}> detail($!{entity} $!{table.entityPath}) {
$!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
return R.data(detail);
}
/**
* 分页 $!{table.comment}
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
public R<IPage<$!{entity}>> list($!{entity} $!{table.entityPath}, Query query) {
IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
return R.data(pages);
}
#end
/**
* 自定义分页 $!{table.comment}
*/
@ -143,7 +169,7 @@ public class $!{table.controllerName} {
* 删除 $!{table.comment}
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperationSupport(order = 8)
@ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-ops</artifactId>
<name>${project.artifactId}</name>
<version>3.2.0</version>
<version>3.3.0</version>
<packaging>pom</packaging>
<modules>
<module>blade-admin</module>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>3.2.0</version>
<version>3.3.0</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -7,12 +7,12 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</parent>
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>3.2.0</version>
<version>3.3.0</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务集合</description>

View File

@ -69,7 +69,7 @@ knife4j:
swagger:
title: SpringBlade 接口文档系统
description: SpringBlade 接口文档系统
version: 3.2.0
version: 3.3.0
license: Powered By SpringBlade
licenseUrl: https://bladex.vip
terms-of-service-url: https://bladex.vip

16
pom.xml
View File

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<packaging>pom</packaging>
<properties>
<blade.tool.version>3.2.0</blade.tool.version>
<blade.project.version>3.2.0</blade.project.version>
<blade.tool.version>3.3.0</blade.tool.version>
<blade.project.version>3.3.0</blade.project.version>
<java.version>1.8</java.version>
<maven.plugin.version>3.8.1</maven.plugin.version>
@ -21,13 +21,13 @@
<captcha.version>1.6.2</captcha.version>
<easyexcel.version>2.2.6</easyexcel.version>
<mica.auto.version>1.2.5</mica.auto.version>
<alibaba.cloud.version>2021.1</alibaba.cloud.version>
<alibaba.nacos.version>2.0.3</alibaba.nacos.version>
<spring.boot.admin.version>2.5.3</spring.boot.admin.version>
<alibaba.cloud.version>2021.0.1.0</alibaba.cloud.version>
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
<spring.boot.admin.version>2.6.2</spring.boot.admin.version>
<spring.plugin.version>2.0.0.RELEASE</spring.plugin.version>
<spring.boot.version>2.5.6</spring.boot.version>
<spring.cloud.version>2020.0.4</spring.cloud.version>
<spring.boot.version>2.6.3</spring.boot.version>
<spring.cloud.version>2021.0.1</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version>
<!-- 推荐使用Harbor -->

View File

@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade
TAG=3.2.0
TAG=3.3.0

View File

@ -152,7 +152,7 @@ spec:
spec:
containers:
- name: blade-admin
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-admin:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-admin:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -386,7 +386,7 @@ spec:
spec:
containers:
- name: blade-auth
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-auth:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-auth:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -625,7 +625,7 @@ spec:
spec:
containers:
- name: blade-desk
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-desk:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-desk:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -864,7 +864,7 @@ spec:
spec:
containers:
- name: blade-develop
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-develop:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-develop:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1096,7 +1096,7 @@ spec:
spec:
containers:
- name: blade-gateway
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-gateway:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-gateway:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1331,7 +1331,7 @@ spec:
spec:
containers:
- name: blade-log
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-log:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-log:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1565,7 +1565,7 @@ spec:
spec:
containers:
- name: blade-report
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-report:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-report:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -1799,7 +1799,7 @@ spec:
spec:
containers:
- name: blade-resource
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-resource:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-resource:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2033,7 +2033,7 @@ spec:
spec:
containers:
- name: blade-system
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-system:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-system:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2267,7 +2267,7 @@ spec:
spec:
containers:
- name: blade-user
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-user:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-user:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -2496,7 +2496,7 @@ spec:
spec:
containers:
- name: saber-web
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-web:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-web:3.3.0'
ports:
- name: web
containerPort: 80
@ -2721,7 +2721,7 @@ spec:
spec:
containers:
- name: blade-swagger
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-swagger:3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/blade-swagger:3.3.0'
args:
- '--spring.profiles.active=${PROFILE}'
- '--spring.cloud.nacos.config.server-addr=${NACOS_SERVER_ADDR}'
@ -3749,7 +3749,7 @@ spec:
spec:
containers:
- name: mysql
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-db:v3.2.0'
image: 'swr.cn-east-2.myhuaweicloud.com/blade/saber-db:v3.3.0'
ports:
- name: mysql
containerPort: 3306