title: Spring testing framework - JNDI resource
body: <p>I am toying a bit with Spring testing framework, but I have one problem. Normally when application is deployed on Tomcat we have </p>
  
  <pre><code>&lt;Resource
         name="jdbc/sqliteDS"
         auth="Container"
         type="javax.sql.DataSource"
         maxActive="4"
         maxIdle="2"
         username="x"
         maxWait="5000"
         driverClassName="org.sqlite.JDBC"
         password="x"
         url="jdbc:sqlite:/home/xxx/db.sqlite"/&gt; 
  
  &lt;/Context&gt;
  </code></pre>
  
  <p>in Tomcat context.xml, </p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;description&gt;sqlite DataSource&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/sqliteDS&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;/resource-ref&gt;
  </code></pre>
  
  <p>in web.xml and </p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
      &lt;property name="jndiName" value="java:/comp/env/jdbc/sqliteDS" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>in data-context.xml
  for getting data source, but how can I emulate JNDI resource for Spring test framework, because now during the initialization I am getting errors that data source is not found, and he is right.</p>
  
  <p>Also, it would be great if one can do that without writing another .xml file.</p>