title: How do you use a Tomcat JNDI JDBC datasource in Spring Boot
body: <p>I have a Spring boot application and want to deploy as a WAR to Tomcat 7. As part of this I need to keep configuration out of the WAR, so that I can deploy the same war to my stage and production servers and have it pickup the mysql connection via configuration.</p>
  
  <p>To this end I want to configure my Spring Boot app to use a mysql connection configured as a JNDI datasource in the Tomcat instance.</p>
  
  <p>Can spring boot do this and if so how?</p>
  
  <p>Alternatively is this easy to do in Spring 4 without resorting to xml based configuration.</p>