mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
1、升级SpringBoot,alibaba,springCloud版本。
2、移除部分在SpringBoot已经定义的依赖,避免版本冲突。 3、升级guava版本。
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.gitee.sop.servercommon.configuration;
|
||||
|
||||
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
|
||||
import com.alibaba.cloud.nacos.NacosServiceManager;
|
||||
import com.alibaba.cloud.nacos.discovery.NacosWatch;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
@@ -21,7 +22,7 @@ public class ServiceConfiguration extends SpringmvcConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@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();
|
||||
String contextPath = environment.getProperty(METADATA_SERVER_CONTEXT_PATH);
|
||||
// 将context-path信息加入到metadata中
|
||||
@@ -31,7 +32,7 @@ public class ServiceConfiguration extends SpringmvcConfiguration {
|
||||
// 在元数据中新增启动时间,不能修改这个值,不然网关拉取接口会有问题
|
||||
// 如果没有这个值,网关会忽略这个服务
|
||||
metadata.put("server.startup-time", String.valueOf(System.currentTimeMillis()));
|
||||
return new NacosWatch(nacosDiscoveryProperties, taskScheduler);
|
||||
return new NacosWatch(nacosServiceManager, nacosDiscoveryProperties, taskScheduler);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user