简体   繁体   中英

How to read from properties file and get values in wsdl file java

In my soap webservice java project i have a properties file in the class path for reading some constants in the project. Its a non maven project, all jars are added directly to the lib folder. Here i want to read from properties file and refer those keys in wsdl file, which is inside WEB-INF folder. How can i add those key in the wsdl file to get the values inside it. Please help and many thanks in advance for your valuable replys.

it's not that hard, you can do it like that:

you have a config.properties file which contains :

database=xxxx
dbuser=myusername
dbpassword=xxxxx
IP= 192.xxxxxx

When you want now to get the username you do :

private static Properties prop;
private String username;
prop = new Properties();
username = prop.getProperty("username"); // you get myusername

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM