mirror of
https://github.com/chillzhuang/SpringBlade.git
synced 2024-12-22 09:09:24 +08:00
🎉 3.0.0.RELEASE 架构升级适配 SpringCloud 2020
This commit is contained in:
parent
16cb17e6a2
commit
7ad26c37f6
@ -1,9 +1,9 @@
|
||||
<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/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%20Boot-2.2.11.RELEASE-blue.svg" alt="Downloads">
|
||||
<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.4.1-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的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构
|
||||
* 稳定生产了三年,经历了从 Camden -> Hoxton -> 2020 的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构。
|
||||
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
|
||||
|
||||
## 架构图
|
||||
|
@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blade-auth</artifactId>
|
||||
@ -65,11 +65,6 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!--Zipkin-->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -16,18 +16,16 @@
|
||||
package org.springblade.auth;
|
||||
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 用户认证服务器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class AuthApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -58,13 +58,17 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<!-- Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
<version>${alibaba.cloud.version}</version>
|
||||
</dependency>
|
||||
<!-- Nacos -->
|
||||
<dependency>
|
||||
|
@ -18,7 +18,6 @@ package org.springblade.gateway;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
@ -26,7 +25,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@EnableHystrix
|
||||
@EnableScheduling
|
||||
@SpringCloudApplication
|
||||
public class GateWayApplication {
|
||||
|
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* 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 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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.springframework.boot.autoconfigure.web.ErrorProperties;
|
||||
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
|
||||
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
||||
import org.springframework.cloud.gateway.support.NotFoundException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.reactive.function.server.*;
|
||||
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.buffer.DataBufferFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
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 java.util.Map;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class ErrorExceptionHandler extends DefaultErrorWebExceptionHandler {
|
||||
@Order(-1)
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class ErrorExceptionHandler implements ErrorWebExceptionHandler {
|
||||
|
||||
public ErrorExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
|
||||
ErrorProperties errorProperties, ApplicationContext applicationContext) {
|
||||
super(errorAttributes, resourceProperties, errorProperties, applicationContext);
|
||||
}
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* 获取异常属性
|
||||
*/
|
||||
@NonNull
|
||||
@Override
|
||||
protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
|
||||
int code = 500;
|
||||
Throwable error = super.getError(request);
|
||||
if (error instanceof NotFoundException) {
|
||||
code = 404;
|
||||
public Mono<Void> handle(ServerWebExchange exchange, @NonNull Throwable ex) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
if (response.isCommitted()) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
if (error instanceof ResponseStatusException) {
|
||||
code = ((ResponseStatusException) error).getStatus().value();
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
if (ex instanceof ResponseStatusException) {
|
||||
response.setStatusCode(((ResponseStatusException) ex).getStatus());
|
||||
}
|
||||
return ResponseProvider.response(code, this.buildMessage(request, error));
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定响应处理方法为JSON处理的方法
|
||||
*
|
||||
* @param errorAttributes
|
||||
*/
|
||||
@Override
|
||||
protected RouterFunction<ServerResponse> getRoutingFunction(ErrorAttributes errorAttributes) {
|
||||
return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取对应的HttpStatus
|
||||
*
|
||||
* @param errorAttributes
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getHttpStatus(Map<String, Object> errorAttributes) {
|
||||
return (int) errorAttributes.get("code");
|
||||
return response.writeWith(Mono.fromSupplier(() -> {
|
||||
DataBufferFactory bufferFactory = response.bufferFactory();
|
||||
try {
|
||||
HttpStatus status = HttpStatus.BAD_GATEWAY;
|
||||
if (ex instanceof ResponseStatusException) {
|
||||
status = ((ResponseStatusException) ex).getStatus();
|
||||
}
|
||||
return bufferFactory.wrap(objectMapper.writeValueAsBytes(ResponseProvider.response(status.value(), buildMessage(request, ex))));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return bufferFactory.wrap(new byte[0]);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建异常信息
|
||||
*
|
||||
* @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 [");
|
||||
message.append(request.methodName());
|
||||
message.append(request.getMethodValue());
|
||||
message.append(" ");
|
||||
message.append(request.uri());
|
||||
message.append(request.getURI());
|
||||
message.append("]");
|
||||
if (ex != null) {
|
||||
message.append(": ");
|
||||
|
@ -75,7 +75,7 @@ public class ResponseProvider {
|
||||
public static Map<String, Object> response(int status, String message) {
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("code", status);
|
||||
map.put("message", message);
|
||||
map.put("msg", message);
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ server:
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
discovery:
|
||||
reactive:
|
||||
enabled: false
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -16,9 +16,9 @@
|
||||
package org.springblade.admin;
|
||||
|
||||
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.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* admin启动器
|
||||
@ -26,7 +26,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
|
||||
* @author Chill
|
||||
*/
|
||||
@EnableAdminServer
|
||||
@SpringCloudApplication
|
||||
@BladeCloudApplication
|
||||
public class AdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -15,18 +15,16 @@
|
||||
*/
|
||||
package org.springblade.develop;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* Develop启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class DevelopApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -15,16 +15,16 @@
|
||||
*/
|
||||
package org.springblade.report;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* UReport启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@BladeCloudApplication
|
||||
public class ReportApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,16 +15,16 @@
|
||||
*/
|
||||
package org.springblade.resource;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* 资源启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@BladeCloudApplication
|
||||
public class ResourceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>SpringBlade 微服务API集合</description>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,15 +15,15 @@
|
||||
*/
|
||||
package com.example.demo;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* Demo启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@BladeCloudApplication
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -15,18 +15,16 @@
|
||||
*/
|
||||
package org.springblade.desk;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* Desk启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class DeskApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
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.service.INoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -12,7 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RunWith(BladeSpringRunner.class)
|
||||
@ExtendWith(BladeSpringExtension.class)
|
||||
@SpringBootTest(classes = DeskApplication.class)
|
||||
@BladeBootTest(appName = "blade-desk", profile = "test", enableLoader = true)
|
||||
public class BladeDemoTest {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,18 +15,16 @@
|
||||
*/
|
||||
package org.springblade.core.log;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 日志服务
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class LogApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,17 +15,15 @@
|
||||
*/
|
||||
package org.springblade.system;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 系统模块启动器
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class SystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -15,18 +15,16 @@
|
||||
*/
|
||||
package org.springblade.system.user;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 用户启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(AppConstant.BASE_PACKAGES)
|
||||
@BladeCloudApplication
|
||||
public class UserApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blade-service</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>SpringBlade 微服务集合</description>
|
||||
|
||||
|
@ -23,40 +23,13 @@ spring:
|
||||
|
||||
#feign配置
|
||||
feign:
|
||||
hystrix:
|
||||
sentinel:
|
||||
enabled: true
|
||||
okhttp:
|
||||
enabled: true
|
||||
httpclient:
|
||||
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:
|
||||
endpoints:
|
||||
|
12
pom.xml
12
pom.xml
@ -5,12 +5,12 @@
|
||||
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<version>3.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<blade.tool.version>2.8.0</blade.tool.version>
|
||||
<blade.project.version>2.8.0</blade.project.version>
|
||||
<blade.tool.version>3.0.0</blade.tool.version>
|
||||
<blade.project.version>3.0.0</blade.project.version>
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
<maven.plugin.version>3.8.1</maven.plugin.version>
|
||||
@ -24,11 +24,11 @@
|
||||
<easyexcel.version>2.2.6</easyexcel.version>
|
||||
<mica.auto.version>1.2.5</mica.auto.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.boot.version>2.2.11.RELEASE</spring.boot.version>
|
||||
<spring.cloud.version>Hoxton.SR8</spring.cloud.version>
|
||||
<spring.boot.version>2.4.1</spring.boot.version>
|
||||
<spring.cloud.version>2020.0.0</spring.cloud.version>
|
||||
<spring.platform.version>Cairo-SR8</spring.platform.version>
|
||||
|
||||
<!-- 推荐使用Harbor -->
|
||||
|
@ -1,2 +1,2 @@
|
||||
REGISTER=192.168.0.157/blade
|
||||
TAG=2.8.0
|
||||
TAG=3.0.0
|
||||
|
@ -42,7 +42,7 @@ base(){
|
||||
|
||||
#启动程序模块
|
||||
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:
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-zipkin:
|
||||
image: "${REGISTER}/blade/blade-zipkin:${TAG}"
|
||||
ports:
|
||||
- 9411:9411
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-gateway1:
|
||||
image: "${REGISTER}/blade/blade-gateway:${TAG}"
|
||||
privileged: true
|
||||
|
Loading…
Reference in New Issue
Block a user