获取application.yml中的值
- 2019-08-21 14:14:00
- admin 原创
- 3078
mport java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Properties; /** * Author:zhansan * Date:2019/8/21 * Description: */ public class PropsUtil { private static Properties props = new Properties(); private static InputStream isp = PropsUtil.class.getClassLoader().getResourceAsStream("application.yml"); public static String get(String arg) { try { props.load(new InputStreamReader(isp, "utf-8")); } catch (IOException e) { e.printStackTrace(); } String result = props.getProperty(arg); return result; } public static String get(String arg, String arg2) { try { props.load(new InputStreamReader(isp, "utf-8")); } catch (IOException e) { e.printStackTrace(); } String result = props.getProperty(arg) + props.getProperty(arg2); return result; } public static String getNoE(String arg) { try { props.load(new InputStreamReader(isp, "utf-8")); } catch (IOException e) { e.printStackTrace(); } String result = props.getProperty(arg); return result; } }
发表评论
文章分类
联系方式
联系人: | 郑州-小万 |
---|---|
电话: | 13803993919 |
Email: | 1027060531@qq.com |
QQ: | 1027060531 |
网址: | www.wanhejia.com |
Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.