mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync code from master
This commit is contained in:
@@ -28,25 +28,25 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class NacosPropertySourceRepository {
|
||||
|
||||
private final static ConcurrentHashMap<String, NacosPropertySource> nacosPropertySourceRepository = new ConcurrentHashMap<>();
|
||||
private final static ConcurrentHashMap<String, NacosPropertySource> NACOS_PROPERTY_SOURCE_REPOSITORY = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* @return all nacos properties from application context
|
||||
*/
|
||||
public static List<NacosPropertySource> getAll() {
|
||||
List<NacosPropertySource> result = new ArrayList<>();
|
||||
result.addAll(nacosPropertySourceRepository.values());
|
||||
result.addAll(NACOS_PROPERTY_SOURCE_REPOSITORY.values());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void collectNacosPropertySources(
|
||||
NacosPropertySource nacosPropertySource) {
|
||||
nacosPropertySourceRepository.putIfAbsent(nacosPropertySource.getDataId(),
|
||||
NACOS_PROPERTY_SOURCE_REPOSITORY.putIfAbsent(nacosPropertySource.getDataId(),
|
||||
nacosPropertySource);
|
||||
}
|
||||
|
||||
public static NacosPropertySource getNacosPropertySource(String dataId) {
|
||||
|
||||
return nacosPropertySourceRepository.get(dataId);
|
||||
return NACOS_PROPERTY_SOURCE_REPOSITORY.get(dataId);
|
||||
}
|
||||
}
|
||||
|
@@ -16,13 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.alibaba.nacos.endpoint;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
|
||||
@@ -30,6 +23,13 @@ import org.springframework.cloud.alibaba.nacos.NacosPropertySourceRepository;
|
||||
import org.springframework.cloud.alibaba.nacos.client.NacosPropertySource;
|
||||
import org.springframework.cloud.alibaba.nacos.refresh.NacosRefreshHistory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Endpoint for Nacos, contains config data and refresh history
|
||||
* @author xiaojing
|
||||
|
Reference in New Issue
Block a user