其他分享
首页 > 其他分享> > spring项目为注入的普通类、过滤器获取配置参数

spring项目为注入的普通类、过滤器获取配置参数

作者:互联网

Properties properties = new Properties();
try {
//加载配置文件
properties.load(RedisUtil.class.getClassLoader().getResourceAsStream("base.properties"));

String host = properties.getProperty("mq.HOST");
String port = properties.getProperty("mq.PORT");
String user_name = properties.getProperty("mq.USER_NAME");
String password = properties.getProperty("mq.PAESSWORD");

 
}

标签:getProperty,String,配置文件,spring,Properties,参数,过滤器,mq,properties
来源: https://www.cnblogs.com/xiao1993/p/16165697.html