Merge branch 'master' into eureka

# Conflicts:
#	sop-admin/sop-admin-server/src/main/resources/public/index.html
#	sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/ServiceConfiguration.java
#	sop-gateway/pom.xml
#	sop-website/sop-website-server/pom.xml
eureka
tanghc 4 years ago
commit 78f81ee180
  1. 6
      doc/docs/files/90001_网关性能测试.md
  2. 4
      doc/docs/files/90100_常见问题.md
  3. 2
      doc/pom.xml
  4. 16
      pom.xml
  5. 4
      sop-admin/pom.xml
  6. 12
      sop-admin/sop-admin-server/pom.xml
  7. 2
      sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.cc77b01c.js
  8. 6
      sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/AccountTest.java
  9. 5
      sop-admin/sop-admin-server/src/test/java/com/gitee/sop/adminserver/SopAdminServerApplicationTests.java
  10. 24
      sop-admin/sop-admin-vue/src/views/isv/index.vue
  11. 6
      sop-auth/pom.xml
  12. 2
      sop-common/pom.xml
  13. 6
      sop-common/sop-bridge-eureka/pom.xml
  14. 6
      sop-common/sop-bridge-nacos/pom.xml
  15. 4
      sop-common/sop-gateway-common/pom.xml
  16. 3
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/GatewayPredicateDefinition.java
  17. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/ServerWebExchangeUtil.java
  18. 68
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java
  19. 10
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java
  20. 4
      sop-common/sop-service-common/pom.xml
  21. 19
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java
  22. 20
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/SpringmvcConfiguration.java
  23. 2
      sop-example/pom.xml
  24. 4
      sop-example/sop-springmvc/pom.xml
  25. 5
      sop-example/sop-springmvc/src/main/java/com/gitee/app/config/OpenServiceConfig.java
  26. 7
      sop-example/sop-springmvc/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
  27. 4
      sop-example/sop-story/pom.xml
  28. 4
      sop-gateway/pom.xml
  29. 4
      sop-sdk/pom.xml
  30. 4
      sop-sdk/sdk-java/pom.xml
  31. 2
      sop-test/pom.xml
  32. 4
      sop-website/pom.xml
  33. 4
      sop-website/sop-portal/README.md
  34. 4
      sop-website/sop-website-server/pom.xml

@ -133,8 +133,8 @@ Transfer/sec: 226.50KB
`restart.sh`
```bash
echo "Stopping sop-gateway-4.2.1-SNAPSHOT.jar"
pid=`ps -ef | grep sop-gateway-4.2.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
echo "Stopping sop-gateway-4.2.2-SNAPSHOT.jar"
pid=`ps -ef | grep sop-gateway-4.2.2-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
echo "kill -9 的id:" $pid
@ -142,7 +142,7 @@ then
fi
nohup java -jar -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc.log \
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8\
-XX:+UseConcMarkSweepGC sop-gateway-4.2.1-SNAPSHOT.jar\
-XX:+UseConcMarkSweepGC sop-gateway-4.2.2-SNAPSHOT.jar\
--spring.profiles.active=dev --server.port=8081 &
tail -f nohup.out

@ -1,5 +1,9 @@
# 常见问题
## primordials is not defined
node版本太高导致与gulp版本不兼容,解决方法:node退回11版本。参考https://blog.csdn.net/zxxzxx23/article/details/103000393
## Nacos指定group
可在配置文件中添加:`spring.cloud.nacos.discovery.group=xxx`指定group,不加默认是:DEFAULT_GROUP

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId>
<artifactId>doc</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<properties>
<!-- Generic properties -->

@ -5,14 +5,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>pom</packaging>
<description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description>
@ -36,12 +36,12 @@
<maven.compiler.target>1.8</maven.compiler.target>
<!-- springboot 版本-->
<spring-boot.version>2.3.4.RELEASE</spring-boot.version>
<spring-boot.version>2.1.8.RELEASE</spring-boot.version>
<!-- spring cloud 版本 -->
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
<spring-cloud.version>Greenwich.SR6</spring-cloud.version>
<!-- spring cloud alibaba 版本 -->
<!-- 具体版本对应关系见:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E -->
<spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version>
<spring-cloud-alibaba.version>2.1.2.RELEASE</spring-cloud-alibaba.version>
<!-- Logging -->
@ -135,6 +135,12 @@
<version>${easyopen.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.7</version>
</dependency>
<dependency>
<groupId>net.oschina.durcframework</groupId>
<artifactId>easyopen-spring-boot-starter</artifactId>

@ -6,13 +6,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>

@ -5,13 +5,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin-server</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
@ -76,6 +76,14 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

@ -2,18 +2,16 @@ package com.gitee.sop.adminserver;
import junit.framework.TestCase;
import org.apache.commons.codec.digest.DigestUtils;
import org.junit.jupiter.api.Test;
/**
* @author tanghc
*/
public class AccountTest extends TestCase {
public class AccountTest extends TestCase {
/*
生成密码
*/
@Test
public void genPwd() {
public void testGen() {
String username = "admin";
String password = "123456";
String save_to_db = DigestUtils.md5Hex(username + DigestUtils.md5Hex(password) + username);

@ -1,6 +1,5 @@
package com.gitee.sop.adminserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@ -9,8 +8,4 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest
public class SopAdminServerApplicationTests {
@Test
public void contextLoads() {
}
}

@ -147,33 +147,26 @@
size="mini"
class="key-view"
>
<el-form-item label="">
<el-alert
title="带 ★ 的分配给开发者"
type="warning"
:closable="false"
/>
</el-form-item>
<el-form-item :label="selfLabel('appId')">
<el-form-item label="appId">
<span>{{ isvKeysFormData.appKey }}</span>
</el-form-item>
<el-form-item v-show="showKeys()" label="秘钥格式">
<span v-if="isvKeysFormData.keyFormat === 1">PKCS8(JAVA适用)</span>
<span v-if="isvKeysFormData.keyFormat === 2">PKCS1(非JAVA适用)</span>
</el-form-item>
<el-form-item v-show="isvKeysFormData.signType === 2" :label="selfLabel('secret')">
<el-form-item v-show="isvKeysFormData.signType === 2" label="secret">
<span>{{ isvKeysFormData.secret }}</span>
</el-form-item>
<el-tabs v-show="showKeys()" v-model="activeName" type="card" class="keyTabs">
<el-tab-pane label="ISV公私钥" name="first">
<el-form-item label="ISV公钥">
<el-input v-model="isvKeysFormData.publicKeyIsv" type="textarea" readonly />
<el-input v-model="isvKeysFormData.publicKeyIsv" type="textarea" placeholder="未上传" readonly />
</el-form-item>
<el-form-item :label="selfLabel('ISV私钥')">
<el-form-item v-show="isvKeysFormData.userId === 0" label="ISV私钥">
<el-input v-model="isvKeysFormData.privateKeyIsv" type="textarea" readonly />
</el-form-item>
</el-tab-pane>
<el-tab-pane label="平台公私钥[可选]" name="second">
<el-tab-pane label="平台公私钥" name="second">
<el-form-item label="平台公钥">
<el-input v-model="isvKeysFormData.publicKeyPlatform" type="textarea" readonly />
</el-form-item>
@ -235,7 +228,8 @@ export default {
privateKeyIsv: '',
publicKeyPlatform: '',
privateKeyPlatform: '',
signType: ''
signType: '',
userId: 0
}
}
},
@ -261,6 +255,7 @@ export default {
this.isvKeysDialogVisible = true
this.$nextTick(() => {
Object.assign(this.isvKeysFormData, resp.data)
this.isvKeysFormData.userId = row.userId
})
})
},
@ -333,9 +328,6 @@ export default {
this.isvDialogFormData.status = 1
this.isvDialogFormData.roleCode = []
},
selfLabel: function(lab) {
return '★ ' + lab
},
roleRender: function(row) {
const html = []
const roleList = row.roleList

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -25,7 +25,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<!-- sop相关配置 end-->
@ -37,7 +37,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sdk-java</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<!-- http请求 -->
<dependency>

@ -6,7 +6,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -5,12 +5,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<artifactId>sop-bridge-eureka</artifactId>
@ -18,7 +18,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<dependency>

@ -5,12 +5,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<artifactId>sop-bridge-nacos</artifactId>
@ -18,7 +18,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<dependency>

@ -5,13 +5,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>

@ -3,7 +3,6 @@ package com.gitee.sop.gatewaycommon.bean;
import lombok.Data;
import org.springframework.util.StringUtils;
import javax.validation.ValidationException;
import java.util.LinkedHashMap;
import java.util.Map;
@ -24,7 +23,7 @@ public class GatewayPredicateDefinition {
public GatewayPredicateDefinition(String text) {
int eqIdx = text.indexOf(61);
if (eqIdx <= 0) {
throw new ValidationException("Unable to parse GatewayPredicateDefinition text '" + text + "', must be of the form name=value");
throw new RuntimeException("Unable to parse GatewayPredicateDefinition text '" + text + "', must be of the form name=value");
} else {
this.setName(text.substring(0, eqIdx));
String[] params = StringUtils.tokenizeToStringArray(text.substring(eqIdx + 1), ",");

@ -3,7 +3,6 @@ package com.gitee.sop.gatewaycommon.gateway;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gitee.sop.gatewaycommon.bean.SopConstants;
import com.gitee.sop.gatewaycommon.gateway.codec.MessageReaderFactory;
import com.gitee.sop.gatewaycommon.gateway.common.FileUploadHttpServletRequest;
import com.gitee.sop.gatewaycommon.gateway.common.RequestContentDataExtractor;
import com.gitee.sop.gatewaycommon.gateway.common.SopServerHttpRequestDecorator;
@ -23,6 +22,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.MultiValueMap;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.reactive.function.server.HandlerStrategies;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilterChain;
@ -47,7 +47,7 @@ public class ServerWebExchangeUtil {
private static final FormHttpMessageConverter formHttpMessageConverter = new FormHttpMessageConverter();
private static final List<HttpMessageReader<?>> messageReaders = MessageReaderFactory.build();
private static final List<HttpMessageReader<?>> messageReaders = HandlerStrategies.withDefaults().messageReaders();
/**
* 重定向

@ -1,68 +0,0 @@
package com.gitee.sop.gatewaycommon.gateway.codec;
import com.gitee.sop.gatewaycommon.manager.EnvironmentKeys;
import org.springframework.core.codec.AbstractDataBufferDecoder;
import org.springframework.core.codec.Decoder;
import org.springframework.http.codec.DecoderHttpMessageReader;
import org.springframework.http.codec.HttpMessageReader;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.server.HandlerStrategies;
import java.lang.reflect.Method;
import java.util.List;
/**
* @author tanghc
*/
public class MessageReaderFactory {
public static final String METHOD_SET_MAX_IN_MEMORY_SIZE = "setMaxInMemorySize";
public static final String METHOD_GET_DECODER = "getDecoder";
public static final int DEFAULT_SIZE = 256 * 1024;
public static List<HttpMessageReader<?>> build() {
String maxInMemorySizeValueStr = EnvironmentKeys.MAX_IN_MEMORY_SIZE.getValue();
int maxInMemorySizeValue = Integer.parseInt(maxInMemorySizeValueStr);
List<HttpMessageReader<?>> messageReaders = HandlerStrategies.withDefaults().messageReaders();
if (DEFAULT_SIZE == maxInMemorySizeValue) {
return messageReaders;
}
// 设置POST缓存大小
for (HttpMessageReader<?> httpMessageReader : messageReaders) {
Method[] methods = ReflectionUtils.getDeclaredMethods(httpMessageReader.getClass());
for (Method method : methods) {
String methodName = method.getName();
if (METHOD_SET_MAX_IN_MEMORY_SIZE.equals(methodName)) {
ReflectionUtils.invokeMethod(method, httpMessageReader, maxInMemorySizeValue);
} else if (METHOD_GET_DECODER.equals(methodName)) {
Object decoder = ReflectionUtils.invokeMethod(method, httpMessageReader);
if (decoder instanceof AbstractDataBufferDecoder) {
AbstractDataBufferDecoder<?> bufferDecoder = (AbstractDataBufferDecoder<?>) decoder;
bufferDecoder.setMaxInMemorySize(maxInMemorySizeValue);
}
}
}
}
return messageReaders;
}
public static void initMaxInMemorySize(ExchangeStrategies exchangeStrategies) {
// 修复返回大文本数据报org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
String maxInMemorySizeValueStr = EnvironmentKeys.MAX_IN_MEMORY_SIZE.getValue();
int maxInMemorySizeValue = Integer.parseInt(maxInMemorySizeValueStr);
if (DEFAULT_SIZE == maxInMemorySizeValue) {
return;
}
for (HttpMessageReader<?> messageReader : exchangeStrategies.messageReaders()) {
if (messageReader instanceof DecoderHttpMessageReader) {
DecoderHttpMessageReader reader = (DecoderHttpMessageReader) messageReader;
Decoder decoder = reader.getDecoder();
if (decoder instanceof AbstractDataBufferDecoder) {
AbstractDataBufferDecoder dataBufferDecoder = (AbstractDataBufferDecoder)decoder;
dataBufferDecoder.setMaxInMemorySize(maxInMemorySizeValue);
}
}
}
}
}

@ -2,7 +2,6 @@ package com.gitee.sop.gatewaycommon.gateway.filter;
import com.gitee.sop.gatewaycommon.bean.ApiContext;
import com.gitee.sop.gatewaycommon.bean.SopConstants;
import com.gitee.sop.gatewaycommon.gateway.codec.MessageReaderFactory;
import com.gitee.sop.gatewaycommon.result.ResultExecutor;
import org.apache.commons.lang3.StringUtils;
import org.reactivestreams.Publisher;
@ -60,7 +59,7 @@ public class GatewayModifyResponseGatewayFilter implements GlobalFilter, Ordered
//this will prevent exception in case of using non-standard media types like "Content-Type: image"
httpHeaders.add(HttpHeaders.CONTENT_TYPE, originalResponseContentType);
ResponseAdapter responseAdapter = new ResponseAdapter(body, httpHeaders);
DefaultClientResponse clientResponse = new DefaultClientResponse(responseAdapter, getExchangeStrategies());
DefaultClientResponse clientResponse = new DefaultClientResponse(responseAdapter, ExchangeStrategies.withDefaults());
//TODO: flux or mono
Mono modifiedBody = clientResponse.bodyToMono(inClass)
@ -97,13 +96,6 @@ public class GatewayModifyResponseGatewayFilter implements GlobalFilter, Ordered
return chain.filter(exchange.mutate().response(responseDecorator).build());
}
private ExchangeStrategies getExchangeStrategies() {
ExchangeStrategies exchangeStrategies = ExchangeStrategies.withDefaults();
// 修复返回大文本数据报org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
MessageReaderFactory.initMaxInMemorySize(exchangeStrategies);
return exchangeStrategies;
}
@Override
public int getOrder() {
return NettyWriteResponseFilter.WRITE_RESPONSE_FILTER_ORDER - 1;

@ -6,13 +6,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-service-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>

@ -1,28 +1,9 @@
package com.gitee.sop.servercommon.configuration;
import com.gitee.sop.servercommon.bean.ServiceConfig;
import com.gitee.sop.servercommon.param.SopHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
/**
* 具备支付宝开放平台服务提供能力
* @author tanghc
*/
public class AlipayServiceConfiguration extends BaseServiceConfiguration {
static {
// 默认版本号为1.0
ServiceConfig.getInstance().setDefaultVersion("1.0");
}
@Autowired
private RequestMappingHandlerAdapter requestMappingHandlerAdapter;
@Override
protected void doAfter() {
super.doAfter();
SopHandlerMethodArgumentResolver sopHandlerMethodArgumentResolver = ServiceConfig.getInstance().getMethodArgumentResolver();
sopHandlerMethodArgumentResolver.setRequestMappingHandlerAdapter(requestMappingHandlerAdapter);
}
}

@ -3,8 +3,11 @@ package com.gitee.sop.servercommon.configuration;
import com.gitee.sop.servercommon.bean.ServiceConfig;
import com.gitee.sop.servercommon.interceptor.ServiceContextInterceptor;
import com.gitee.sop.servercommon.message.ServiceErrorFactory;
import com.gitee.sop.servercommon.param.SopHandlerMethodArgumentResolver;
import com.gitee.sop.servercommon.route.ServiceRouteController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.HttpMessageConverter;
@ -12,6 +15,7 @@ import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import javax.annotation.PostConstruct;
import java.nio.charset.StandardCharsets;
@ -21,10 +25,14 @@ import java.util.List;
* @author tanghc
*/
@Slf4j
public class SpringmvcConfiguration implements WebMvcConfigurer {
public class SpringmvcConfiguration implements WebMvcConfigurer, BeanPostProcessor {
public static final String METADATA_SERVER_CONTEXT_PATH = "server.servlet.context-path";
static {
ServiceConfig.getInstance().setDefaultVersion("1.0");
}
public SpringmvcConfiguration() {
ServiceConfig.getInstance().getI18nModules().add("i18n/isp/bizerror");
}
@ -33,6 +41,16 @@ public class SpringmvcConfiguration implements WebMvcConfigurer {
System.setProperty("eureka.instance.metadata-map.server.startup-time", String.valueOf(System.currentTimeMillis()));
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof RequestMappingHandlerAdapter) {
RequestMappingHandlerAdapter requestMappingHandlerAdapter = (RequestMappingHandlerAdapter) bean;
SopHandlerMethodArgumentResolver sopHandlerMethodArgumentResolver = ServiceConfig.getInstance().getMethodArgumentResolver();
sopHandlerMethodArgumentResolver.setRequestMappingHandlerAdapter(requestMappingHandlerAdapter);
}
return bean;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 支持swagger-bootstrap-ui首页

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -26,7 +26,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<!-- nacos -->
<dependency>

@ -6,7 +6,6 @@ import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import com.alibaba.nacos.client.naming.utils.NetUtils;
import com.alibaba.nacos.spring.context.annotation.discovery.EnableNacosDiscovery;
import com.gitee.sop.servercommon.bean.ServiceConfig;
import com.gitee.sop.servercommon.configuration.SpringmvcConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@ -27,10 +26,6 @@ public class OpenServiceConfig extends SpringmvcConfiguration {
public static final String SERVER_PORT = "server.port";
public static final String METADATA_TIME_STARTUP = "server.startup-time";
static {
ServiceConfig.getInstance().setDefaultVersion("1.0");
}
@Value("${spring.application.name}")
private String serviceId;
@Value("${server.port}")

@ -31,12 +31,7 @@
<property name="suffix" value=".jsp" />
</bean>
<!-- 接入SOP配置 -->
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="com.gitee.sop.servercommon.param.ApiArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
<mvc:annotation-driven />
<bean class="com.gitee.app.config.OpenServiceConfig"/>

@ -4,7 +4,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -19,7 +19,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<dependency>

@ -4,7 +4,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -24,7 +24,7 @@
<groupId>com.gitee.sop</groupId>
<!-- <artifactId>sop-bridge-nacos</artifactId>-->
<artifactId>sop-bridge-eureka</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<dependency>

@ -6,13 +6,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-sdk</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>

@ -4,13 +4,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sdk-java</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<properties>
<!-- Generic properties -->

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -6,13 +6,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-website</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>

@ -4,6 +4,10 @@
# 初始化
安装node,建议安装11版本,12版本会有不兼容问题。
安装完毕执行:
npm install
# 启动

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-website</artifactId>
<version>4.2.1-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -25,7 +25,7 @@
<groupId>com.gitee.sop</groupId>
<!-- <artifactId>sop-bridge-nacos</artifactId>-->
<artifactId>sop-bridge-eureka</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.2-SNAPSHOT</version>
</dependency>
<dependency>

Loading…
Cancel
Save