spring中如何读取properties文件的属性?
properties文件中有个属性name=name1;name2;name3我要在spring配置文件中把3个name属性拆开,应该怎么读?...
properties文件中有个属性name=name1;name2;name3
我要在spring配置文件中把3个name属性拆开,应该怎么读? 展开
我要在spring配置文件中把3个name属性拆开,应该怎么读? 展开
2个回答
展开全部
java.util.Properties
有方法:
void load(InputStream inStream)
Reads a property list (key and element pairs) from the input byte stream.
void load(Reader reader)
Reads a property list (key and element pairs) from the input character stream in a simple line-oriented format.
读属性的方法:
String getProperty(String key)
Searches for the property with the specified key in this property list.
String getProperty(String key, String defaultValue)
Searches for the property with the specified key in this property list.
分拆,就看java.lang.String类
有方法:
void load(InputStream inStream)
Reads a property list (key and element pairs) from the input byte stream.
void load(Reader reader)
Reads a property list (key and element pairs) from the input character stream in a simple line-oriented format.
读属性的方法:
String getProperty(String key)
Searches for the property with the specified key in this property list.
String getProperty(String key, String defaultValue)
Searches for the property with the specified key in this property list.
分拆,就看java.lang.String类
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询