title: How to give java.util.Properties object to spring to resolve properties values in spring like ${mail.port} from the Properties object
body: <p>Hi I am creating a stand alone jar of a spring application, it will be a utility service, so i will get object of  java.util.Properties and i need to use this properties in my spring application,</p>
  
  <p>so i need to do is create a class that takes Properties object as argument in its constructure</p>
  
  <p>what i have done is </p>
  
  <pre><code>public class MailService {
  public MailService(Properties properties) {
          PropertySourcesPlaceholderConfigurer pops = new PropertySourcesPlaceholderConfigurer();
              pops.setProperties(properties);
              ClassPathXmlApplicationContext ctx = null;
              try {
                  ctx = new ClassPathXmlApplicationContext("/resources/xml/spring/mailservice_context.xml");
  
              } catch (Exception e) {
                  e.printStackTrace();
              } finally {
                  if (ctx != null) {
                      ctx.close();
                      ctx = null;
                  }
              }
  
      }
  }
  </code></pre>
  
  <p><strong>and i want "mail.host" , "mail.port" from the properties object that i have passed in constructor of  MailService</strong> </p>
  
  <pre><code>&lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
          &lt;property name="host" value="${mail.host}" /&gt;
          &lt;property name="port" value="${mail.port}" /&gt;
          &lt;property name="username" value="${mail.username}" /&gt;
          &lt;property name="password" value="${mail.password}" /&gt;
          &lt;property name="javaMailProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="mail.transport.protocol"&gt;${mail.transport.protocol}&lt;/prop&gt;
                  &lt;prop key="mail.smtps.auth"&gt;${mail.smtps.auth}&lt;/prop&gt;
                  &lt;prop key="mail.smtps.starttls.enable"&gt;${mail.smtps.starttls.enable}&lt;/prop&gt; 
                  &lt;prop key="mail.debug"&gt;${mail.debug}&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>How i can get this values from properties object of java , <strong>i am using spring 4.1</strong> </p>