以配置Jedis为例:
jedis.properties
maxtotal=100
maxwaitmillis=3000
host=127.0.0.1
port=6379
JedisUtil
private static int maxtotal;
private static int maxwaitmillis;
private static String host;
private static int port;
/*读取jedis.properties配置文件*/
static
{
ResourceBundle rb = ResourceBundle.getBundle("jedis");
maxtotal = Integer.parseInt(rb.getString("maxtotal"));
maxwaitmillis = Integer.parseInt(rb.getString("maxwaitmillis"));
host = rb.getString("host");
port = Integer.parseInt(rb.getString("port"));
}