title: java string subsitutions using object
body: <p>Output of the below code is : </p>
  
  <p>This is Raja from <strong>${Address.Street}</strong> i did my <strong>${Education.degree}</strong> from <strong>${Education.university}</strong></p>
  
  <p>but what I need is </p>
  
  <p>This is <strong>Raja</strong> from <strong>Namakkal</strong> i did my <strong>B.E</strong> from <strong>Anna University</strong></p>
  
  <p>is it possible to achieve by using <code>Freemarker</code>, <code>OGNL</code> or by using <code>spring</code>.</p>
  
  <pre><code>    public class Test 
      {   
       public static void main(String arg[]) throws TemplateModelException
        {
  
          Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
          Map&lt;String, Object&gt; address = new HashMap&lt;String, Object&gt;();             
  
          address.put("Street", "Namakkal");     
  
          Qualification qualification = new Test.Qualification();    
  
          map.put("Name", "Raja");
          map.put("Address", address);
          map.put("Education", qualification);
  
  
          StrSubstitutor strsub = new StrSubstitutor(map);
  
          String str = "This is ${Name} from ${Address.Street} i did my ${Education.degree} from ${Education.university}";
  
          System.out.println(strsub.replace(str));
      }
  
      public static class Qualification
      {
          public String getDegree()
          {
              return "B.E";
          }
  
          public String getUniversity()
          {
              return "Anna University";
          }
      }
  }
  </code></pre>
  
  <p>please explain the simplest and effective way to achieve this.</p>