[2021.x]Separate nacos ConfigService initialization from normal properties bean. (#3787)
parent
4079d321e9
commit
16ddf584c9
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2023 the original author or authors.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* 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 com.alibaba.cloud.nacos.configdata;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.alibaba.cloud.nacos.NacosConfigProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for initialization of Nacos ConfigService.
|
||||||
|
*/
|
||||||
|
public class NacosConfigDataLoadProperties extends NacosConfigProperties {
|
||||||
|
private Map<String, String> config = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void enrichNacosConfigProperties(Properties nacosConfigProperties) {
|
||||||
|
config.forEach((k, v) -> nacosConfigProperties.putIfAbsent(resolveKey(k),
|
||||||
|
String.valueOf(v)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setConfig(Map<String, String> config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue