日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java修改配置文件参数_在java类中获取在.properties配置文件中设置的参数

發(fā)布時間:2024/7/23 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java修改配置文件参数_在java类中获取在.properties配置文件中设置的参数 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

如何獲取.properties配置文件中的參數(shù),我在網(wǎng)上查了半天沒弄明白,后來在以前的項目中找到了,就寫下來,避免遺忘。

1.配置文件:message_product.properties

total_product=2

service1=1,新股發(fā)行短信提醒服務(wù),發(fā)行的詳細(xì)信息

service2=2,配股短信提醒服務(wù)&增發(fā)短信提醒服務(wù),增發(fā)的詳細(xì)信息

validatecode_temp=驗證碼:${vilidateCode}。

#消息持續(xù)發(fā)送時間,單位”小時“

message_constant_time=24

#消息的編碼格式 15 GBK編碼 30 彩信 31 wappush 32 長短信 33個性彩信'

message_formart=15

#'消息的優(yōu)先級: 0 最低 --- 3 最高';

message_priority=3

#'消息的下發(fā)類型: 0 免費下發(fā) 1 按條下發(fā) 2 包月下發(fā) 3 訂閱請求 4 取消請求 5 包月扣費';

message_type=0

#產(chǎn)品ID numproductid

message_product_id=724

#numchannelid

message_channelid=0

2.java 類

package com.margin.utils;

import java.io.UnsupportedEncodingException;

import java.util.ResourceBundle;

import com.margin.po.MessageProduct;

public class MessageProperties {

private static ResourceBundle rb;

static {

rb = ResourceBundle.getBundle("message_product");

}

/**

* 得到短信服務(wù)總數(shù)

* @return

*/

public static int getTotalProduct() {

return Integer.parseInt(rb.getString("total_product"));

}

/**

* 消息持續(xù)發(fā)送時間

* @return

*/

public static int getMessageConstantTime()

{

return Integer.parseInt(rb.getString("message_constant_time").trim());

}

/**

* 消息格式

* @return

*/

public static int getMessageFormat()

{

return Integer.parseInt(rb.getString("message_formart").trim());

}

/**

* 消息發(fā)送優(yōu)先級

* @return

*/

public static int getMessagePriority()

{

return Integer.parseInt(rb.getString("message_priority").trim());

}

總結(jié)

以上是生活随笔為你收集整理的java修改配置文件参数_在java类中获取在.properties配置文件中设置的参数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。