title: include database.properties from spring project into web.xml
body: <p>I have a database project which is using <code>spring</code>. For that I have two important files in <code>src/META-INF/spring/</code>(database project)</p>
  
  <p>The first one is the cmn-dao-spring.xml . The other one is the database.properties.</p>
  
  <p>In my tomcat webapp project I am able to load with that code all the needed context-files:</p>
  
  <pre><code>  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
                classpath*:/META-INF/spring/*.xml  
      &lt;/param-value&gt;
    &lt;/context-param&gt;
  </code></pre>
  
  <p>The problem is that the <code>database.properties</code> is not loaded.
  If I change the xml to this:</p>
  
  <pre><code>  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
                classpath*:/META-INF/spring/*  
      &lt;/param-value&gt;
    &lt;/context-param&gt;
  </code></pre>
  
  <p>I get the Exception:</p>
  
  <pre><code>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
  </code></pre>
  
  <p>because the <code>properties</code> is no valid <code>xml</code>.
  The startup of my tomcat fails.</p>
  
  <p>How can I include the <code>database.properties</code> from my cmn-dao project in my webapp?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>That is my cmn-dao.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
      &lt;tx:annotation-driven /&gt;
      &lt;context:annotation-config /&gt;
      &lt;!-- DATABASE CONFIGURATION --&gt;
  
      &lt;bean
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="location"&gt;
              &lt;value&gt;META-INF/spring/database.properties&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt;
          &lt;property name="url" value="${jdbc.url}" /&gt;
          &lt;property name="username" value="${jdbc.username}" /&gt;
          &lt;property name="password" value="${jdbc.password}" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
          class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- BEAN DEFINITIONS --&gt;
  
      &lt;bean id="scoreMapper" class="de.bc.qz.dao.mapper.ScoreMapper"
          autowire="byName"&gt;
          &lt;constructor-arg value="s." /&gt;
      &lt;/bean&gt;
      &lt;bean id="scoreExtractor" class="de.bc.qz.dao.extractor.ScoreExtractor"
          autowire="byName"&gt;
      &lt;/bean&gt;
      &lt;bean id="questionMapper" class="de.bc.qz.dao.mapper.QuestionMapper"
          autowire="byName"&gt;
          &lt;constructor-arg value="q." /&gt;
      &lt;/bean&gt;
      &lt;bean id="complaintMapper" class="de.bc.qz.dao.mapper.ComplaintMapper"
          autowire="byName"&gt;
          &lt;constructor-arg value="c." /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="scoreDao" class="de.bc.qz.dao.ScoreDao" autowire="byName"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="LAUSFT"&gt;
              &lt;value&gt;
                  SELECT * FROM (
                  SELECT s.*, @rank
                  := @rank + 1 rank
                  FROM
                  quiz.score s, (SELECT @rank := 0) init
                  ORDER BY points DESC
                  ) s
                  WHERE rank BETWEEN ? AND ?
                  ORDER BY rank;
          &lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="LUS"&gt;
              &lt;value&gt;
                  SELECT id
                  FROM quiz.score
                  WHERE username = ? AND uuid = ?;
          &lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="complaintDao" class="de.bc.qz.dao.ComplaintDao"
          autowire="byName"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
      &lt;bean id="questionDao" class="de.bc.qz.dao.QuestionDao" autowire="byName"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>The JUnit's for cmn-dao works absolut correct and the placeholder works too.
  Inside tomcat project I have added the related projects via <code>Deployment Assembly</code>.</p>
  
  <p>Thx for your help
  Stefan</p>