title: Spring jdbctemplate best way
body: <p>The spring.xml</p>
  
  <pre><code>&lt;bean id="jdbcTemp" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
      &lt;property name="dataSource" ref="portalDataSource" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In class</p>
  
  <pre><code>    @Repository
  public class DBUtil{
  
      private static final long serialVersionUID = -6203751104015962909L;
      @Autowired
      JdbcTemplate jdbcTemp;
  
      private static Logger log = Logger.getLogger("scmLogger");
  
      @Transactional(readOnly=true)
      public List&lt;Map&lt;String, Object&gt;&gt; getData(String qry, Object[] pAttr){
          log.debug("DBUtil.getData() qry "+qry);
          List&lt;Map&lt;String, Object&gt;&gt; vList =  new ArrayList&lt;Map&lt;String,Object&gt;&gt;(); 
          vList = jdbcTemp.queryForList(qry, pAttr);
          return vList;
      }
  </code></pre>
  
  <p>I would like to know if this "jdbcTemplate" is a singleton i.e a single instance in my application. Is this the best way to use or any other way which will be better. Please suggest.</p>
  
  <h2>Regards</h2>
  
  <p>Adeeb</p>