title: How to share propertyplaceholder for 2 context
body: <p>I have Spring MVC web application on Spring 3.2.4.
  i have 2 context. 
  1. mvc-dispatcher-servlet.xml look like this :</p>
  
  <pre><code>&lt;context:annotation-config/&gt;
      &lt;context:component-scan base-package="com.ja.dom"/&gt;
  
      &lt;!-- Tiles 3 config --&gt;
  
      &lt;bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;!--Don't add suffix or prefix like you do with .jsp files--&gt;
          &lt;property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer" &gt;
          &lt;property name="definitions"&gt;
              &lt;value&gt;/WEB-INF/tiles.xml&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>and 2. root-context.xml like this :</p>
  
  <p>
       </p>
  
  <pre><code> &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
       &lt;property name="locations" value="classpath:prop.properties"/&gt;
   &lt;/bean&gt;
  
   &lt;!-- Mail Sender Bean --&gt;
  
  &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
       &lt;property name="host" value="smtp.gmail.com" /&gt;
       &lt;property name="port" value="587" /&gt;
       &lt;property name="username" value="${email.name}" /&gt;
       &lt;property name="password" value="${email.password}" /&gt;
       &lt;property name="defaultEncoding" value="UTF-8"/&gt;
  
       &lt;property name="javaMailProperties"&gt;
           &lt;props&gt;
               &lt;prop key="mail.smtp.auth"&gt;true&lt;/prop&gt;
               &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt;
               &lt;prop key="mail.debug"&gt;true&lt;/prop&gt;
           &lt;/props&gt;
       &lt;/property&gt;
   &lt;/bean&gt;
  </code></pre>
  
  <p>When i run application, i see what only mailSender bean have param from properties file.
  My other beans, etc @Service .. not be injected. What's wrong? 
  How to share my PropertyPlaceholderConfigurer to mvc-dispatcher-servlet context?</p>
  
  <p>I inject properties on Service like this :</p>
  
  <blockquote>
    <p>@Value("${reCaptcha.private.key}")
        private String reCaptchaPrivateKey;</p>
  </blockquote>
  
  <p>and my web.xml <strong>(UPDATE)</strong></p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0"&gt;
  
      &lt;display-name&gt;Spring MVC Application&lt;/display-name&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/root-context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;!--&lt;init-param&gt;--&gt;
              &lt;!--&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;--&gt;
              &lt;!--&lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml&lt;/param-value&gt;--&gt;
          &lt;!--&lt;/init-param&gt;--&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
  
  
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>