热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.springframework.core.env.MapPropertySource.getSource()方法的使用及代码示例

本文整理了Java中org.springframework.core.env.MapPropertySource.getSource()方法的一些代码示例,展示了

本文整理了Java中org.springframework.core.env.MapPropertySource.getSource()方法的一些代码示例,展示了MapPropertySource.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MapPropertySource.getSource()方法的具体详情如下:
包路径:org.springframework.core.env.MapPropertySource
类名称:MapPropertySource
方法名:getSource

MapPropertySource.getSource介绍

暂无

代码示例

代码示例来源:origin: spring-cloud/spring-cloud-kubernetes

/**
* Determines if two property sources are different.
*/
protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) {
if (mp1 == mp2)
return false;
if (mp1 == null && mp2 != null || mp1 != null && mp2 == null)
return true;
Map s1 = mp1.getSource();
Map s2 = mp2.getSource();
return s1 == null ? s2 != null : !s1.equals(s2);
}

代码示例来源:origin: spring-projects/spring-framework

environment.getPropertySources().addFirst(ps);
ps.getSource().putAll(convertInlinedPropertiesToMap(inlinedProperties));

代码示例来源:origin: org.springframework.boot/spring-boot

private void assertEnumerablePropertySource() {
if (getPropertySource() instanceof MapPropertySource) {
try {
((MapPropertySource) getPropertySource()).getSource().size();
}
catch (UnsupportedOperationException ex) {
throw new IllegalArgumentException(
"PropertySource must be fully enumerable");
}
}
}

代码示例来源:origin: org.springframework.boot/spring-boot

public static CacheKey get(EnumerablePropertySource source) {
if (source instanceof MapPropertySource) {
return new CacheKey(((MapPropertySource) source).getSource().keySet());
}
return new CacheKey(source.getPropertyNames());
}

代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba

/**
* Copy from {@link BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)}
*
* @param propertySources {@link MutablePropertySources}
* @param map Default RocketMQ Bus Properties
*/
private void addOrReplace(MutablePropertySources propertySources,
Map map) {
MapPropertySource target = null;
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
PropertySource source = propertySources.get(PROPERTY_SOURCE_NAME);
if (source instanceof MapPropertySource) {
target = (MapPropertySource) source;
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
target.getSource().put(key, map.get(key));
}
}
}
}
if (target == null) {
target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
}
if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
propertySources.addLast(target);
}
}

代码示例来源:origin: apache/incubator-dubbo-spring-boot-project

/**
* Copy from BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map)
*
* @param propertySources {@link MutablePropertySources}
* @param map Default Dubbo Properties
*/
private void addOrReplace(MutablePropertySources propertySources,
Map map) {
MapPropertySource target = null;
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
PropertySource source = propertySources.get(PROPERTY_SOURCE_NAME);
if (source instanceof MapPropertySource) {
target = (MapPropertySource) source;
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
target.getSource().put(key, map.get(key));
}
}
}
}
if (target == null) {
target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
}
if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
propertySources.addLast(target);
}
}
}

代码示例来源:origin: spring-io/initializr

private static void addOrReplace(MutablePropertySources propertySources,
Map map) {
MapPropertySource target = null;
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
PropertySource source = propertySources.get(PROPERTY_SOURCE_NAME);
if (source instanceof MapPropertySource) {
target = (MapPropertySource) source;
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
target.getSource().put(key, map.get(key));
}
}
}
}
if (target == null) {
target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
}
if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
propertySources.addLast(target);
}
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

private void addOrReplace(MutablePropertySources propertySources,
Map map) {
MapPropertySource target = null;
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
PropertySource source = propertySources.get(PROPERTY_SOURCE_NAME);
if (source instanceof MapPropertySource) {
target = (MapPropertySource) source;
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
target.getSource().put(key, map.get(key));
}
}
}
}
if (target == null) {
target = new MapPropertySource(PROPERTY_SOURCE_NAME, map);
}
if (!propertySources.contains(PROPERTY_SOURCE_NAME)) {
propertySources.addLast(target);
}
}

代码示例来源:origin: fabric8io/spring-cloud-kubernetes

/**
* Determines if two property sources are different.
*/
protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) {
if (mp1 == mp2) return false;
if (mp1 == null && mp2 != null || mp1 != null && mp2 == null) return true;
Map s1 = mp1.getSource();
Map s2 = mp2.getSource();
return s1 == null ? s2 != null : !s1.equals(s2);
}

代码示例来源:origin: Teradata/kylo

/**
* get All properties
*/
public Map getAllProperties() {
if (properties == null || properties.isEmpty()) {
synchronized (SpringEnvironmentProperties.class) {
if (properties == null || properties.isEmpty()) {
Map map = new HashMap();
for (Iterator it = ((AbstractEnvironment) env).getPropertySources().iterator(); it.hasNext(); ) {
PropertySource propertySource = (PropertySource) it.next();
if (propertySource instanceof MapPropertySource) {
map.putAll(((MapPropertySource) propertySource).getSource());
}
}
//decrypt
Map decryptedMap = new HashMap();
for (String k : map.keySet()) {
decryptedMap.put(k, env.getProperty(k));
}
properties = decryptedMap;
}
}
}
return properties;
}

代码示例来源:origin: ulisesbocchio/jasypt-spring-boot

public EncryptableMapPropertySourceWrapper(MapPropertySource delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) {
super(delegate.getName(), delegate.getSource());
encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter);
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-context

private void mergeDefaultProperties(MutablePropertySources environment,
MutablePropertySources bootstrap) {
String name = DEFAULT_PROPERTIES;
if (bootstrap.contains(name)) {
PropertySource source = bootstrap.get(name);
if (!environment.contains(name)) {
environment.addLast(source);
}
else {
PropertySource target = environment.get(name);
if (target instanceof MapPropertySource) {
Map targetMap = ((MapPropertySource) target)
.getSource();
if (target != source) {
if (source instanceof MapPropertySource) {
Map map = ((MapPropertySource) source)
.getSource();
for (String key : map.keySet()) {
if (!target.containsProperty(key)) {
targetMap.put(key, map.get(key));
}
}
}
}
}
}
}
mergeAdditionalPropertySources(environment, bootstrap);
}

代码示例来源:origin: io.fabric8/spring-cloud-kubernetes-core

/**
* Determines if two property sources are different.
*/
protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) {
if (mp1 == mp2) return false;
if (mp1 == null && mp2 != null || mp1 != null && mp2 == null) return true;
Map s1 = mp1.getSource();
Map s2 = mp2.getSource();
return s1 == null ? s2 != null : !s1.equals(s2);
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-kubernetes-config

/**
* Determines if two property sources are different.
*/
protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) {
if (mp1 == mp2)
return false;
if (mp1 == null && mp2 != null || mp1 != null && mp2 == null)
return true;
Map s1 = mp1.getSource();
Map s2 = mp2.getSource();
return s1 == null ? s2 != null : !s1.equals(s2);
}

代码示例来源:origin: com.atlassian.connect/ac-spring-boot-autoconfigure

@Override
public Set getDescriptors() {
final ImmutableSet.Builder builder = ImmutableSet.builder();
builder.add(new HostNameScopeDescriptor());
for (final PropertySource propertySource : env.getPropertySources()) {
if (propertySource instanceof MapPropertySource) {
final Map source = ((MapPropertySource) propertySource).getSource();
for (Map.Entry entry : source.entrySet()) {
builder.add(new StaticDescriptorScope(entry.getKey().toString(), entry.getValue()));
}
}
}
return builder.build();
}
}

代码示例来源:origin: com.alipay.sofa/infra-sofa-boot-starter

/**
* config log settings
*/
private void assemblyLogSetting(ConfigurableEnvironment environment) {
StreamSupport.stream(environment.getPropertySources().spliterator(), false)
.filter(propertySource -> propertySource instanceof EnumerablePropertySource)
.map(propertySource -> Arrays
.asList(((MapPropertySource) propertySource).getPropertyNames()))
.flatMap(Collection::stream).filter(LogEnvUtils::filterAllLogConfig)
.forEach((key) -> HIGH_PRIORITY_CONFIG.getSource().put(key, environment.getProperty(key)));
}

代码示例来源:origin: com.alipay.sofa/infra-sofa-boot-starter

/**
* config required properties
* @param environment
*/
private void assemblyRequireProperties(ConfigurableEnvironment environment) {
if (StringUtils.hasText(environment.getProperty(SofaBootInfraConstants.APP_NAME_KEY))) {
HIGH_PRIORITY_CONFIG.getSource().put(SofaBootInfraConstants.APP_NAME_KEY,
environment.getProperty(SofaBootInfraConstants.APP_NAME_KEY));
}
}

代码示例来源:origin: com.github.ulisesbocchio/jasypt-spring-boot

public EncryptableMapPropertySourceWrapper(MapPropertySource delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) {
super(delegate.getName(), delegate.getSource());
encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter);
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-contract-stub-runner

private void registerPort(RunningStubs runStubs) {
MutablePropertySources propertySources = this.environment.getPropertySources();
if (!propertySources.contains(STUBRUNNER_PREFIX)) {
propertySources.addFirst(new MapPropertySource(STUBRUNNER_PREFIX,
new HashMap()));
}
Map source = ((MapPropertySource) propertySources
.get(STUBRUNNER_PREFIX)).getSource();
for (Map.Entry entry : runStubs.validNamesAndPorts()
.entrySet()) {
source.put(STUBRUNNER_PREFIX + "." + entry.getKey().getArtifactId() + ".port",
entry.getValue());
// there are projects where artifact id is the same, what differs is the group
// id
source.put(STUBRUNNER_PREFIX + "." + entry.getKey().getGroupId() + "."
+ entry.getKey().getArtifactId() + ".port", entry.getValue());
}
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

private void addDefaultProperty(ConfigurableEnvironment environment, String name,
String value) {
MutablePropertySources sources = environment.getPropertySources();
Map map = null;
if (sources.contains("defaultProperties")) {
PropertySource source = sources.get("defaultProperties");
if (source instanceof MapPropertySource) {
map = ((MapPropertySource) source).getSource();
}
} else {
map = new LinkedHashMap<>();
sources.addLast(new MapPropertySource("defaultProperties", map));
}
if (map != null) {
map.put(name, value);
}
}
}

推荐阅读
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了Python爬虫技术基础篇面向对象高级编程(中)中的多重继承概念。通过继承,子类可以扩展父类的功能。文章以动物类层次的设计为例,讨论了按照不同分类方式设计类层次的复杂性和多重继承的优势。最后给出了哺乳动物和鸟类的设计示例,以及能跑、能飞、宠物类和非宠物类的增加对类数量的影响。 ... [详细]
  • 本文介绍了在iOS开发中使用UITextField实现字符限制的方法,包括利用代理方法和使用BNTextField-Limit库的实现策略。通过这些方法,开发者可以方便地限制UITextField的字符个数和输入规则。 ... [详细]
  • 本文介绍了在MFC下利用C++和MFC的特性动态创建窗口的方法,包括继承现有的MFC类并加以改造、插入工具栏和状态栏对象的声明等。同时还提到了窗口销毁的处理方法。本文详细介绍了实现方法并给出了相关注意事项。 ... [详细]
  • 本文介绍了Java中Currency类的getInstance()方法,该方法用于检索给定货币代码的该货币的实例。文章详细解释了方法的语法、参数、返回值和异常,并提供了一个示例程序来说明该方法的工作原理。 ... [详细]
  • 本文介绍了在Android开发中使用软引用和弱引用的应用。如果一个对象只具有软引用,那么只有在内存不够的情况下才会被回收,可以用来实现内存敏感的高速缓存;而如果一个对象只具有弱引用,不管内存是否足够,都会被垃圾回收器回收。软引用和弱引用还可以与引用队列联合使用,当被引用的对象被回收时,会将引用加入到关联的引用队列中。软引用和弱引用的根本区别在于生命周期的长短,弱引用的对象可能随时被回收,而软引用的对象只有在内存不够时才会被回收。 ... [详细]
  • Netty源代码分析服务器端启动ServerBootstrap初始化
    本文主要分析了Netty源代码中服务器端启动的过程,包括ServerBootstrap的初始化和相关参数的设置。通过分析NioEventLoopGroup、NioServerSocketChannel、ChannelOption.SO_BACKLOG等关键组件和选项的作用,深入理解Netty服务器端的启动过程。同时,还介绍了LoggingHandler的作用和使用方法,帮助读者更好地理解Netty源代码。 ... [详细]
  • 解决Sharepoint 2013运行状况分析出现的“一个或多个服务器未响应”问题的方法
    本文介绍了解决Sharepoint 2013运行状况分析中出现的“一个或多个服务器未响应”问题的方法。对于有高要求的客户来说,系统检测问题的存在是不可接受的。文章详细描述了解决该问题的步骤,包括删除服务器、处理分布式缓存留下的记录以及使用代码等方法。同时还提供了相关关键词和错误提示信息,以帮助读者更好地理解和解决该问题。 ... [详细]
  • Ihaveaworkfolderdirectory.我有一个工作文件夹目录。holderDir.glob(*)>holder[ProjectOne, ... [详细]
  • PHP反射API的功能和用途详解
    本文详细介绍了PHP反射API的功能和用途,包括动态获取信息和调用对象方法的功能,以及自动加载插件、生成文档、扩充PHP语言等用途。通过反射API,可以获取类的元数据,创建类的实例,调用方法,传递参数,动态调用类的静态方法等。PHP反射API是一种内建的OOP技术扩展,通过使用Reflection、ReflectionClass和ReflectionMethod等类,可以帮助我们分析其他类、接口、方法、属性和扩展。 ... [详细]
  • Spring框架《一》简介
    Spring框架《一》1.Spring概述1.1简介1.2Spring模板二、IOC容器和Bean1.IOC和DI简介2.三种通过类型获取bean3.给bean的属性赋值3.1依赖 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • 本文讨论了微软的STL容器类是否线程安全。根据MSDN的回答,STL容器类包括vector、deque、list、queue、stack、priority_queue、valarray、map、hash_map、multimap、hash_multimap、set、hash_set、multiset、hash_multiset、basic_string和bitset。对于单个对象来说,多个线程同时读取是安全的。但如果一个线程正在写入一个对象,那么所有的读写操作都需要进行同步。 ... [详细]
author-avatar
小彩菜
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有