本文整理匯總了Java中org.springframework.core.io.support.PropertiesLoaderUtils.loadAllProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertiesLoaderUtils.loadAllProperties方法的具體用法?Java PropertiesLoaderUtils.loadAllProperties怎麽用?Java PropertiesLoaderUtils.loadAllProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.core.io.support.PropertiesLoaderUtils
的用法示例。
在下文中一共展示了PropertiesLoaderUtils.loadAllProperties方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.springframework.core.io.support.PropertiesLoaderUtils; //導入方法依賴的package包/類
/**
* Load the lease config from properties, and init the lockConfigMap.
*/
@PostConstruct
public void init() {
try {
// Using default path if no specified
confPath = StringUtils.isBlank(confPath) ? DEFAULT_CONF_PATH : confPath;
// Load lock config from properties
Properties properties = PropertiesLoaderUtils.loadAllProperties(confPath);
// Build the lockConfigMap
for (Entry<Object, Object> propEntry : properties.entrySet()) {
DLockType lockType = EnumUtils.valueOf(DLockType.class, propEntry.getKey().toString());
Integer lease = Integer.valueOf(propEntry.getValue().toString());
if (lockType != null && lease != null) {
lockConfigMap.put(lockType, lease);
}
}
} catch (Exception e) {
throw new RuntimeException("Load distributed lock config fail", e);
}
}
示例2: loadAllProperties
import org.springframework.core.io.support.PropertiesLoaderUtils; //導入方法依賴的package包/類
public static void loadAllProperties(String propertyFileName) {
try {
Properties properties = PropertiesLoaderUtils.loadAllProperties(propertyFileName);
processProperties(properties);
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: getVersionProperties
import org.springframework.core.io.support.PropertiesLoaderUtils; //導入方法依賴的package包/類
public Properties getVersionProperties() {
try {
return PropertiesLoaderUtils.loadAllProperties("/META-INF/version.properties");
} catch (IOException e) {
LOG.error("Unable to load version information", e);
return new Properties();
}
}
示例4: setup
import org.springframework.core.io.support.PropertiesLoaderUtils; //導入方法依賴的package包/類
@Before
public void setup() {
try {
appProperties = PropertiesLoaderUtils.loadAllProperties("application.properties");
}
catch (IOException e) {
}
List<String> jdbcProperties = new ArrayList<>();
for (Object key : appProperties.keySet()) {
jdbcProperties.add(key + "=" + appProperties.get(key));
}
this.jdbc = jdbcProperties.toArray(new String[0]);
}
開發者ID:spring-cloud-stream-app-starters,項目名稱:jdbc,代碼行數:14,代碼來源:PgcopyBadErrorTableIntegrationTests.java