title: how to inject map type object in spring 3.0
body: <p>In DAO:</p>
  
  <pre><code>private Map&lt;Integer,String&gt; departments = new LinkedHashMap&lt;Integer, String&gt;();
  
  @Override
  public List&lt;DepartmentEntity&gt; getAllDepartments() {
      return this.sessionFactory.getCurrentSession().createQuery("from DepartmentEntity de order by LOWER(de.departmentname)").list();
  
  }
  
  @Override
  public Map&lt;Integer, String&gt; loadDepartments() {
      departments.clear();
      for (DepartmentEntity de : getAllDepartments())
          departments.put(de.getDepartmentid(), de.getDepartmentname());
      return departments;
  }
  </code></pre>
  
  <p>Its Working fine, but in spring creation of objects manually its bad code</p>
  
  <pre><code>private Map&lt;Integer,String&gt; departments;
  </code></pre>
  
  <p>So, how to inject map object of LinkedHashMap type from out side in my case ?.</p>
  
  <p>I tried but i got exceptions like null pointer exception</p>
  
  <p>Please any one help me..</p>