How to Read key value from .properties file in Spring

Connect with

How to read properties in SpringHow to read properties file in Spring Java specially single .properties file or multiple properties file in Java spring framework is very easy, it can be done by different way.

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.
how to read properties file in spring file:

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 PropertyPlaceholderConfigurer class.



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.

Connect with

Leave a Comment

Your email address will not be published. Required fields are marked *