Read Properties File Key Value Spring Java Class

Read Properties File Key Value Spring Java Class

These are the things people forget all the time at-least in my case for sure hopefully you are also in the same boat. So keep this thing handy somewhere so that we can refer anytime. This one is if you want to read properties file key in your java class while using Spring framework in your application:

  • Sample.properties:

  • Properties files placeholder in your context:

  • Read in class:

  • You could also do this:

  • OR if above doesn’t work:

Reference:

Leave a Reply

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