Read .properties properties file - today's depression

zhaozj2021-02-16  85

method one:

Properties PROPS = New Properties (); Props.Load (BugFactory.class.getResourceAsStream ("xx.properties");

String name = props.getpropery ("xxxx");

At this time, XX.Properties should be placed with this class in the same directory.

Method Two:

ResourceBundle Res = ResourceBundle.getBundle ("YY.Properties");

String name = res. maxString ("YYYY");

YY.Properties should be placed in / web-inf / classes directory

I put XX.Properties in the / web-inf / class directory, I have been working for a long time.

转载请注明原文地址:https://www.9cbs.com/read-13144.html

New Post(0)