title: Spring @PropertySource set path dynamically
body: <p>I am developing Core java application using Spring Core.And this application will work as executable jar.</p>
  
  <p>This application has configuration file which will load using @PropertySource and currently this path set as "class-path:".</p>
  
  <p>I will install this executable jar on different different machine. the executable jar folder path will be different.</p>
  
  <p>I need to put this projectconfig.properties outside the jar file so that user can able to set the configuration as per his requirement. <strong>How can I do this?</strong></p>
  
  <p><strong>How i can set path dynamically?</strong></p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.PropertySource;
  import org.springframework.core.env.Environment;
  import org.springframework.stereotype.Component;
  @Component
  @PropertySource("classpath:com/org/abc/xyz/properties/projectconfig.properties")
  public class ProjectConfig {
  
  @Autowired
  private Environment env;
  
  public String getProperty(String propName) {
      return env.getProperty(propName);
  }   
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ey8j9.jpg" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Thank you in advance!</p>