In this post I will explain how to read .properties files by using use
PropertyPlaceholderConfigurer class of Spring framework, which contains in spring core module itself.
mongo.host=10.10.8.8 mongo.db=mydb mongo.port=27017 mongo.userName=mydbUser mongo.password=mydbUser@123 ftp.driverdata.location=/opt/mydbApp/data/
2. Single properties file in xml meta data configuration
If you have single properties file which you want to read in java spring framework. you can simply follow and you done with properties file reading in java. let us say, you have to use
location property of
3. Multiple properties file reading in java
If you have multiple properties file , you have to user
locations property of
PropertyPlaceholderConfigurer class. If .properties file outside of your application you can use absolute path with prefix as
file:. If within you application you can use
classpath: prefix in you location. You can use
locations property as well if you have only one .properties file.
Your comments are welcome. Happy Learning 🙂 for learning of how to read .properties find java Spring framework.