It’s a good idea to resolve the configuration properties from external files and Spring supports this feature which is quite easy to use. You just need to put the properties file(s) in the classpath, for example in the Maven application APP_ROOT/src/main/resources/ Let’s modify the SimplePoem class from our previous example of spring to have the poem string resolved from the file:

For @Value to work, you will have to add the following line of code to your spring config file which will configure all the annotated properties.

Finally, you will have to mention the in the spring config file like this:

and your file looks like this: