1、升级SpringBoot,alibaba,springCloud版本。

2、移除部分在SpringBoot已经定义的依赖,避免版本冲突。
3、升级guava版本。
pull/7/MERGE
林志强 4 years ago committed by tanghc
parent ad16abe9f4
commit 8c8b1c7442
  1. 16
      pom.xml
  2. 5
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/ServiceConfiguration.java

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version> <version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
@ -36,17 +36,17 @@
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<!-- springboot 版本--> <!-- springboot 版本-->
<spring-boot.version>2.2.5.RELEASE</spring-boot.version> <spring-boot.version>2.3.4.RELEASE</spring-boot.version>
<!-- spring cloud 版本 --> <!-- spring cloud 版本 -->
<spring-cloud.version>Hoxton.SR3</spring-cloud.version> <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
<!-- spring cloud alibaba 版本 --> <!-- spring cloud alibaba 版本 -->
<!-- 具体版本对应关系见:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E --> <!-- 具体版本对应关系见: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.1.RELEASE</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version>
<!-- Logging --> <!-- Logging -->
<logback.version>1.2.3</logback.version> <logback.version>1.2.3</logback.version>
<slf4j.version>1.7.5</slf4j.version> <!-- <slf4j.version>1.7.5</slf4j.version>-->
<!-- Test --> <!-- Test -->
<junit.version>4.11</junit.version> <junit.version>4.11</junit.version>
@ -58,11 +58,11 @@
<commons-lang3.version>3.8.1</commons-lang3.version> <commons-lang3.version>3.8.1</commons-lang3.version>
<commons-codec.version>1.11</commons-codec.version> <commons-codec.version>1.11</commons-codec.version>
<commons-logging.version>1.2</commons-logging.version> <commons-logging.version>1.2</commons-logging.version>
<validation-api.version>2.0.1.Final</validation-api.version> <!-- <validation-api.version>2.0.1.Final</validation-api.version>-->
<hibernate-validator.version>6.0.13.Final</hibernate-validator.version> <!-- <hibernate-validator.version>6.0.13.Final</hibernate-validator.version>-->
<fastmybatis.version>1.9.1</fastmybatis.version> <fastmybatis.version>1.9.1</fastmybatis.version>
<spring-data-redis.version>2.3.0.RELEASE</spring-data-redis.version> <spring-data-redis.version>2.3.0.RELEASE</spring-data-redis.version>
<guava.version>27.1-jre</guava.version> <guava.version>29.0-jre</guava.version>
<swagger.version>1.5.21</swagger.version> <swagger.version>1.5.21</swagger.version>
<springfox-spring-web.version>2.9.2</springfox-spring-web.version> <springfox-spring-web.version>2.9.2</springfox-spring-web.version>
<springfox-swagger2.version>2.9.2</springfox-swagger2.version> <springfox-swagger2.version>2.9.2</springfox-swagger2.version>

@ -1,6 +1,7 @@
package com.gitee.sop.servercommon.configuration; package com.gitee.sop.servercommon.configuration;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.cloud.nacos.NacosServiceManager;
import com.alibaba.cloud.nacos.discovery.NacosWatch; import com.alibaba.cloud.nacos.discovery.NacosWatch;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
@ -21,7 +22,7 @@ public class ServiceConfiguration extends SpringmvcConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@ConditionalOnProperty("spring.cloud.nacos.discovery.server-addr") @ConditionalOnProperty("spring.cloud.nacos.discovery.server-addr")
public NacosWatch nacosWatch(NacosDiscoveryProperties nacosDiscoveryProperties, ObjectProvider<TaskScheduler> taskScheduler, Environment environment) { public NacosWatch nacosWatch(NacosDiscoveryProperties nacosDiscoveryProperties, ObjectProvider<TaskScheduler> taskScheduler, Environment environment, NacosServiceManager nacosServiceManager) {
Map<String, String> metadata = nacosDiscoveryProperties.getMetadata(); Map<String, String> metadata = nacosDiscoveryProperties.getMetadata();
String contextPath = environment.getProperty(METADATA_SERVER_CONTEXT_PATH); String contextPath = environment.getProperty(METADATA_SERVER_CONTEXT_PATH);
// 将context-path信息加入到metadata中 // 将context-path信息加入到metadata中
@ -31,7 +32,7 @@ public class ServiceConfiguration extends SpringmvcConfiguration {
// 在元数据中新增启动时间,不能修改这个值,不然网关拉取接口会有问题 // 在元数据中新增启动时间,不能修改这个值,不然网关拉取接口会有问题
// 如果没有这个值,网关会忽略这个服务 // 如果没有这个值,网关会忽略这个服务
metadata.put("server.startup-time", String.valueOf(System.currentTimeMillis())); metadata.put("server.startup-time", String.valueOf(System.currentTimeMillis()));
return new NacosWatch(nacosDiscoveryProperties, taskScheduler); return new NacosWatch(nacosServiceManager, nacosDiscoveryProperties, taskScheduler);
} }
} }

Loading…
Cancel
Save