List of usage examples for org.springframework.core.env PropertySource containsProperty
public boolean containsProperty(String name)
From source file:io.bitsquare.app.BitsquareEnvironment.java
BitsquareEnvironment(PropertySource commandLineProperties) { String userDataDir = commandLineProperties.containsProperty(USER_DATA_DIR_KEY) ? (String) commandLineProperties.getProperty(USER_DATA_DIR_KEY) : DEFAULT_USER_DATA_DIR;/*from w w w . jav a 2 s .co m*/ this.appName = commandLineProperties.containsProperty(APP_NAME_KEY) ? (String) commandLineProperties.getProperty(APP_NAME_KEY) : DEFAULT_APP_NAME; this.appDataDir = commandLineProperties.containsProperty(APP_DATA_DIR_KEY) ? (String) commandLineProperties.getProperty(APP_DATA_DIR_KEY) : appDataDir(userDataDir, appName); MutablePropertySources propertySources = this.getPropertySources(); propertySources.addFirst(commandLineProperties); try { propertySources.addLast(filesystemProperties()); propertySources.addLast(classpathProperties()); propertySources.addLast(defaultProperties()); } catch (Exception ex) { throw new BitsquareException(ex); } }
From source file:io.pivotal.springcloud.ssl.CloudFoundryCertificateTruster.java
@Override public void initialize(ConfigurableApplicationContext applicationContext) { if (!inited) { inited = true;/*from ww w .jav a 2s . c om*/ String trustCertUrls = null; String trustStore = null; String trustStorePassword = null; ConfigurableEnvironment environment = applicationContext.getEnvironment(); for (PropertySource<?> propertySource : environment.getPropertySources()) { if (propertySource.containsProperty("app.ssl.trustStore")) trustStore = (String) propertySource.getProperty("app.ssl.trustStore"); if (propertySource.containsProperty("app.ssl.trustStorePassword")) trustStorePassword = (String) propertySource.getProperty("app.ssl.trustStorePassword"); if (propertySource.containsProperty("app.ssl.trustCertUrls")) trustCertUrls = (String) propertySource.getProperty("app.ssl.trustCertUrls"); } if (trustCertUrls != null) trustCertificatesFromURLInternal(trustCertUrls); if (trustStore != null) trustCertificatesFromStoreInternal(applicationContext, trustStore, trustStorePassword); } }