title: Design for Hibernate external config for app server and local Eclipse
body: <p>I have found many posts on here about using Spring to externalize the Hibernate settings so it's not in the <code>hibernate.cfg.xml</code> config file. However, my question revolves around having a development environment that uses Eclipse and then deploying the generated WAR file out on a separate server.</p>
  
  <p>I am currently using Eclipse Luna and deploying my Spring MVC web application to a local install of Tomcat 8. The <code>hibernate.cfg.xml</code> file currently resides in the <strong>resources</strong> folder. When I deploy it locally, it works great. However, the config uses my personal login credentials, which isn't good to have on the server for everyone to see. </p>
  
  <p>What I need is to figure out a design to have the application work locally and when I deploy on the server.</p>
  
  <p>I was thinking about creating a folder called <strong>conf</strong> and placing the <code>hibernate.cfg.xml</code> file in here and through the Eclipse classpath (Debug As configuration...) define it as a folder. That should allow the local version to still read in the proper files and work. But I am stuck on how to setup the server side of this. Since we just drop in the WAR file, it will auto deploy. I can use a <code>PropertyPlaceholderConfigurer</code>, but that will throw errors on my local copy.</p>
  
  <p>The only other thing I can think of is to create a process where I create the folder for the application, unpack the WAR file into this folder each time minus the <strong>conf</strong> folder. And only update the <strong>conf</strong> folder on the server.</p>
  
  <p>Is this a good design or is there a better way? I appreciate all the help and guidance on this!</p>