Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

Springframework provides lots of ways to inject values into your code. What do you do when you need access to a value of something contained in a .properties file. This is so easy, but I rarely use it and always forget how to use it. This is how you define a properties:

<util:properties id="commonProperties" location=""/>

The contents of the properties file is:

To inject it into a class:

    private String hostUrl;

March 14th, 2014

Posted In: Java, Spring

Tags: , ,

Leave a Reply

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

WP to LinkedIn Auto Publish Powered By :