标签:frame xxxxx rip cat portal public rac nes dad
注意需要引入spring的架包,spring-core-xxxxx
1.PropertiesUtil.java
package com.h3c.portal.business.common.util; import org.springframework.core.io.support.PropertiesLoaderUtils; import java.io.IOException; import java.util.Properties; /** * 读取Properties配置文件内的参数 */ public class PropertiesUtil { public static void main(String[] args) { Properties prop = getProperties_1(); // 根据关键字查询相应的值 String value = prop.getProperty("OA_DBNAME"); System.out.println("wechat_appid = " + value); System.out.println("*********************************************"); } public static Properties getProperties_1() { Properties prop = null; try { // 通过Spring中的PropertiesLoaderUtils工具类进行获取 prop = PropertiesLoaderUtils.loadAllProperties("conf/url.properties"); } catch (IOException e) { e.printStackTrace(); } return prop; } }
2.url.properties
OA_DBNAME=test OA_SERVERIP=10.1.1.11 OA_DB_USERNAME=oa_aas OA_DB_USERPWD=oa_dad_12313
标签:frame xxxxx rip cat portal public rac nes dad
原文地址:https://www.cnblogs.com/Jack-zhao/p/13032683.html