Java Code Examples for org.springframework.core.env.MapPropertySource#getSource()

The following examples show how to use org.springframework.core.env.MapPropertySource#getSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigurationChangeDetector.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
/**
 * Determines if two property sources are different.
 * @param mp1 map property sources 1
 * @param mp2 map property sources 2
 * @return {@code true} if source has changed
 */
protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) {
	if (mp1 == mp2) {
		return false;
	}
	if (mp1 == null && mp2 != null || mp1 != null && mp2 == null) {
		return true;
	}

	Map<String, Object> s1 = mp1.getSource();
	Map<String, Object> s2 = mp2.getSource();

	return s1 == null ? s2 != null : !s1.equals(s2);
}
 
Example 2
Source File: ConfigurationChangeDetector.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
/**
 * 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<String, Object> s1 = mp1.getSource();
    Map<String, Object> s2 = mp2.getSource();

    return s1 == null ? s2 != null : !s1.equals(s2);
}
 
Example 3
Source File: CustomRuntimeEnvironmentPostProcessor.java    From spring-cloud-function with Apache License 2.0 5 votes vote down vote up
private Map<String, Object> getDefaultProperties(
		ConfigurableEnvironment environment) {
	if (environment.getPropertySources().contains("defaultProperties")) {
		MapPropertySource source = (MapPropertySource) environment
				.getPropertySources().get("defaultProperties");
		return source.getSource();
	}
	HashMap<String, Object> map = new HashMap<String, Object>();
	environment.getPropertySources()
			.addLast(new MapPropertySource("defaultProperties", map));
	return map;
}
 
Example 4
Source File: ReleaseMessage.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
public static ReleasePropertySource build(MapPropertySource mapSource) {
	if (mapSource == null) {
		return null;
	}
	return new ReleasePropertySource(mapSource.getName(), mapSource.getSource());
}
 
Example 5
Source File: EncryptableMapPropertySourceWrapper.java    From jasypt-spring-boot with MIT License 4 votes vote down vote up
public EncryptableMapPropertySourceWrapper(MapPropertySource delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) {
    super(delegate.getName(), delegate.getSource());
    encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter);
}