提交 d12ad51d 编写于 作者: S smallchill

🎉 3.0.0.RELEASE 架构升级适配 SpringCloud 2020

上级 98b1e21e
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Release-V2.8.0-green.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Release-V3.0.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/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/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR8-blue.svg" alt="Coverage 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.2.11.RELEASE-blue.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Spring%20Boot-2.4.1-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip"> <a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a> </a>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* 极简封装了多租户底层,用更少的代码换来拓展性更强的SaaS多租户系统。 * 极简封装了多租户底层,用更少的代码换来拓展性更强的SaaS多租户系统。
* 借鉴OAuth2,实现了多终端认证系统,可控制子系统的token权限互相隔离。 * 借鉴OAuth2,实现了多终端认证系统,可控制子系统的token权限互相隔离。
* 借鉴Security,封装了Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。 * 借鉴Security,封装了Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。
* 稳定生产了两年,经历了从Camden -> Hoxton的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构 * 稳定生产了三年,经历了从 Camden -> Hoxton -> 2020 的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。 * 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图 ## 架构图
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<artifactId>blade-auth</artifactId> <artifactId>blade-auth</artifactId>
...@@ -65,11 +65,6 @@ ...@@ -65,11 +65,6 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!--Zipkin-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>-->
</dependencies> </dependencies>
<build> <build>
......
...@@ -16,18 +16,16 @@ ...@@ -16,18 +16,16 @@
package org.springblade.auth; package org.springblade.auth;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* 用户认证服务器 * 用户认证服务器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class AuthApplication { public class AuthApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -58,13 +58,17 @@ ...@@ -58,13 +58,17 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId> <artifactId>spring-cloud-starter-loadbalancer</artifactId>
<exclusions> </dependency>
<exclusion> <dependency>
<groupId>commons-logging</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>commons-logging</artifactId> <artifactId>spring-cloud-starter-bootstrap</artifactId>
</exclusion> </dependency>
</exclusions> <!-- Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>${alibaba.cloud.version}</version>
</dependency> </dependency>
<!-- Nacos --> <!-- Nacos -->
<dependency> <dependency>
......
...@@ -18,7 +18,6 @@ package org.springblade.gateway; ...@@ -18,7 +18,6 @@ package org.springblade.gateway;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
/** /**
...@@ -26,7 +25,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -26,7 +25,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* *
* @author Chill * @author Chill
*/ */
@EnableHystrix
@EnableScheduling @EnableScheduling
@SpringCloudApplication @SpringCloudApplication
public class GateWayApplication { public class GateWayApplication {
......
/**
* 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.gateway.config;
import org.springblade.gateway.handler.ErrorExceptionHandler;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.reactive.error.ErrorAttributes;
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.web.reactive.result.view.ViewResolver;
import java.util.Collections;
import java.util.List;
/**
* 异常处理配置类
*
* @author Chill
*/
@Configuration
@EnableConfigurationProperties({ServerProperties.class, ResourceProperties.class})
public class ErrorHandlerConfiguration {
private final ServerProperties serverProperties;
private final ApplicationContext applicationContext;
private final ResourceProperties resourceProperties;
private final List<ViewResolver> viewResolvers;
private final ServerCodecConfigurer serverCodecConfigurer;
public ErrorHandlerConfiguration(ServerProperties serverProperties,
ResourceProperties resourceProperties,
ObjectProvider<List<ViewResolver>> viewResolversProvider,
ServerCodecConfigurer serverCodecConfigurer,
ApplicationContext applicationContext) {
this.serverProperties = serverProperties;
this.applicationContext = applicationContext;
this.resourceProperties = resourceProperties;
this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
this.serverCodecConfigurer = serverCodecConfigurer;
}
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
ErrorExceptionHandler exceptionHandler = new ErrorExceptionHandler(
errorAttributes,
this.resourceProperties,
this.serverProperties.getError(),
this.applicationContext);
exceptionHandler.setViewResolvers(this.viewResolvers);
exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
return exceptionHandler;
}
}
...@@ -13,81 +13,73 @@ ...@@ -13,81 +13,73 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springblade.gateway.handler; package org.springblade.gateway.handler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import org.springblade.gateway.provider.ResponseProvider; import org.springblade.gateway.provider.ResponseProvider;
import org.springframework.boot.autoconfigure.web.ErrorProperties; import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
import org.springframework.boot.autoconfigure.web.ResourceProperties; import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler; import org.springframework.core.annotation.Order;
import org.springframework.boot.web.reactive.error.ErrorAttributes; import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.cloud.gateway.support.NotFoundException; import org.springframework.http.HttpStatus;
import org.springframework.context.ApplicationContext; import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.*; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.lang.NonNull;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange;
import java.util.Map; import reactor.core.publisher.Mono;
/** /**
* 异常处理 * 异常处理
* *
* @author Chill * @author Chill
*/ */
public class ErrorExceptionHandler extends DefaultErrorWebExceptionHandler { @Order(-1)
@Configuration
@RequiredArgsConstructor
public class ErrorExceptionHandler implements ErrorWebExceptionHandler {
public ErrorExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties, private final ObjectMapper objectMapper;
ErrorProperties errorProperties, ApplicationContext applicationContext) {
super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
/** @NonNull
* 获取异常属性
*/
@Override @Override
protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) { public Mono<Void> handle(ServerWebExchange exchange, @NonNull Throwable ex) {
int code = 500; ServerHttpRequest request = exchange.getRequest();
Throwable error = super.getError(request); ServerHttpResponse response = exchange.getResponse();
if (error instanceof NotFoundException) { if (response.isCommitted()) {
code = 404; return Mono.error(ex);
} }
if (error instanceof ResponseStatusException) { response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
code = ((ResponseStatusException) error).getStatus().value(); if (ex instanceof ResponseStatusException) {
response.setStatusCode(((ResponseStatusException) ex).getStatus());
} }
return ResponseProvider.response(code, this.buildMessage(request, error)); return response.writeWith(Mono.fromSupplier(() -> {
} DataBufferFactory bufferFactory = response.bufferFactory();
try {
/** HttpStatus status = HttpStatus.BAD_GATEWAY;
* 指定响应处理方法为JSON处理的方法 if (ex instanceof ResponseStatusException) {
* status = ((ResponseStatusException) ex).getStatus();
* @param errorAttributes }
*/ return bufferFactory.wrap(objectMapper.writeValueAsBytes(ResponseProvider.response(status.value(), buildMessage(request, ex))));
@Override } catch (JsonProcessingException e) {
protected RouterFunction<ServerResponse> getRoutingFunction(ErrorAttributes errorAttributes) { e.printStackTrace();
return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse); return bufferFactory.wrap(new byte[0]);
} }
}));
/**
* 根据code获取对应的HttpStatus
*
* @param errorAttributes
* @return
*/
@Override
protected int getHttpStatus(Map<String, Object> errorAttributes) {
return (int) errorAttributes.get("code");
} }
/** /**
* 构建异常信息 * 构建异常信息
*
* @param request
* @param ex
* @return
*/ */
private String buildMessage(ServerRequest request, Throwable ex) { private String buildMessage(ServerHttpRequest request, Throwable ex) {
StringBuilder message = new StringBuilder("Failed to handle request ["); StringBuilder message = new StringBuilder("Failed to handle request [");
message.append(request.methodName()); message.append(request.getMethodValue());
message.append(" "); message.append(" ");
message.append(request.uri()); message.append(request.getURI());
message.append("]"); message.append("]");
if (ex != null) { if (ex != null) {
message.append(": "); message.append(": ");
......
...@@ -75,7 +75,7 @@ public class ResponseProvider { ...@@ -75,7 +75,7 @@ public class ResponseProvider {
public static Map<String, Object> response(int status, String message) { public static Map<String, Object> response(int status, String message) {
Map<String, Object> map = new HashMap<>(16); Map<String, Object> map = new HashMap<>(16);
map.put("code", status); map.put("code", status);
map.put("message", message); map.put("msg", message);
map.put("data", null); map.put("data", null);
return map; return map;
} }
......
...@@ -3,9 +3,6 @@ server: ...@@ -3,9 +3,6 @@ server:
spring: spring:
cloud: cloud:
discovery:
reactive:
enabled: false
gateway: gateway:
discovery: discovery:
locator: locator:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
package org.springblade.admin; package org.springblade.admin;
import de.codecentric.boot.admin.server.config.EnableAdminServer; import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
/** /**
* admin启动器 * admin启动器
...@@ -26,7 +26,7 @@ import org.springframework.cloud.client.SpringCloudApplication; ...@@ -26,7 +26,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
* @author Chill * @author Chill
*/ */
@EnableAdminServer @EnableAdminServer
@SpringCloudApplication @BladeCloudApplication
public class AdminApplication { public class AdminApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
*/ */
package org.springblade.develop; package org.springblade.develop;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* Develop启动器 * Develop启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class DevelopApplication { public class DevelopApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
*/ */
package org.springblade.report; package org.springblade.report;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
/** /**
* UReport启动器 * UReport启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
public class ReportApplication { public class ReportApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
*/ */
package org.springblade.resource; package org.springblade.resource;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
/** /**
* 资源启动器 * 资源启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
public class ResourceApplication { public class ResourceApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>2.8.0</version> <version>3.0.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description> <description>SpringBlade 微服务API集合</description>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
*/ */
package com.example.demo; package com.example.demo;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.cloud.client.SpringCloudApplication;
/** /**
* Demo启动器 * Demo启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
public class DemoApplication { public class DemoApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
*/ */
package org.springblade.desk; package org.springblade.desk;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* Desk启动器 * Desk启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class DeskApplication { public class DeskApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springblade.core.test.BladeBootTest; import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringRunner; import org.springblade.core.test.BladeSpringExtension;
import org.springblade.desk.DeskApplication; import org.springblade.desk.DeskApplication;
import org.springblade.desk.service.INoticeService; import org.springblade.desk.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,7 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest; ...@@ -12,7 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest;
* *
* @author Chill * @author Chill
*/ */
@RunWith(BladeSpringRunner.class) @ExtendWith(BladeSpringExtension.class)
@SpringBootTest(classes = DeskApplication.class) @SpringBootTest(classes = DeskApplication.class)
@BladeBootTest(appName = "blade-desk", profile = "test", enableLoader = true) @BladeBootTest(appName = "blade-desk", profile = "test", enableLoader = true)
public class BladeDemoTest { public class BladeDemoTest {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
*/ */
package org.springblade.core.log; package org.springblade.core.log;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* 日志服务 * 日志服务
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class LogApplication { public class LogApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,17 +15,15 @@ ...@@ -15,17 +15,15 @@
*/ */
package org.springblade.system; package org.springblade.system;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* 系统模块启动器 * 系统模块启动器
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class SystemApplication { public class SystemApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
*/ */
package org.springblade.system.user; package org.springblade.system.user;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* 用户启动器 * 用户启动器
* *
* @author Chill * @author Chill
*/ */
@SpringCloudApplication @BladeCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class UserApplication { public class UserApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<version>2.8.0</version> <version>3.0.0</version>
</parent> </parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>2.8.0</version> <version>3.0.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务集合</description> <description>SpringBlade 微服务集合</description>
......
...@@ -23,40 +23,13 @@ spring: ...@@ -23,40 +23,13 @@ spring:
#feign配置 #feign配置
feign: feign:
hystrix: sentinel:
enabled: true enabled: true
okhttp: okhttp:
enabled: true enabled: true
httpclient: httpclient:
enabled: false enabled: false
#hystrix配置
hystrix:
threadpool:
default:
coreSize: 300
maxQueueSize: 1000
queueSizeRejectionThreshold: 800
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 5000
#ribbon配置
ribbon:
#对当前实例的重试次数
MaxAutoRetries: 1
#切换实例的重试次数
MaxAutoRetriesNextServer: 2
#请求处理的超时时间
ReadTimeout: 60000
#请求连接的超时时间
ConnectTimeout: 60000
#对所有操作请求都进行重试
OkToRetryOnAllOperations: true
#对外暴露端口 #对外暴露端口
management: management:
endpoints: endpoints:
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<version>2.8.0</version> <version>3.0.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<blade.tool.version>2.8.0</blade.tool.version> <blade.tool.version>3.0.0</blade.tool.version>
<blade.project.version>2.8.0</blade.project.version> <blade.project.version>3.0.0</blade.project.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.plugin.version>3.8.1</maven.plugin.version> <maven.plugin.version>3.8.1</maven.plugin.version>
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
<easyexcel.version>2.2.6</easyexcel.version> <easyexcel.version>2.2.6</easyexcel.version>
<mica.auto.version>1.2.5</mica.auto.version> <mica.auto.version>1.2.5</mica.auto.version>
<alibaba.cloud.version>2.2.3.RELEASE</alibaba.cloud.version> <alibaba.cloud.version>2.2.3.RELEASE</alibaba.cloud.version>
<spring.boot.admin.version>2.3.0</spring.boot.admin.version> <spring.boot.admin.version>2.3.1</spring.boot.admin.version>
<spring.plugin.version>2.0.0.RELEASE</spring.plugin.version> <spring.plugin.version>2.0.0.RELEASE</spring.plugin.version>
<spring.boot.version>2.2.11.RELEASE</spring.boot.version> <spring.boot.version>2.4.1</spring.boot.version>
<spring.cloud.version>Hoxton.SR8</spring.cloud.version> <spring.cloud.version>2020.0.0</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version> <spring.platform.version>Cairo-SR8</spring.platform.version>
<!-- 推荐使用Harbor --> <!-- 推荐使用Harbor -->
......
REGISTER=192.168.0.157/blade REGISTER=192.168.0.157/blade
TAG=2.8.0 TAG=3.0.0
...@@ -42,7 +42,7 @@ base(){ ...@@ -42,7 +42,7 @@ base(){
#启动程序模块 #启动程序模块
modules(){ modules(){
docker-compose up -d blade-gateway1 blade-gateway2 blade-admin blade-zipkin blade-auth1 blade-auth2 blade-user blade-desk blade-system blade-log docker-compose up -d blade-gateway1 blade-gateway2 blade-admin blade-auth1 blade-auth2 blade-user blade-desk blade-system blade-log
} }
#关闭所有模块 #关闭所有模块
......
...@@ -71,15 +71,6 @@ services: ...@@ -71,15 +71,6 @@ services:
networks: networks:
- blade_net - blade_net
blade-zipkin:
image: "${REGISTER}/blade/blade-zipkin:${TAG}"
ports:
- 9411:9411
privileged: true
restart: always
networks:
- blade_net
blade-gateway1: blade-gateway1:
image: "${REGISTER}/blade/blade-gateway:${TAG}" image: "${REGISTER}/blade/blade-gateway:${TAG}"
privileged: true privileged: true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册