Two ways for java to get parameter values in config.properties

During web development, some general configuration information is often placed in config.properties in the form of kv, such as database information, as shown below:

 

Then load the configuration file config.properties in the code, and take out the defined configuration information one by one. Here are two methods:

The first:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324489243&siteId=291194637