title: Spring Boot application to read a value from properties file in main method
body: <p>I am trying to get the value of a property</p>
  
  <pre><code>hello.world=Hello World
  </code></pre>
  
  <p>in MainApp class</p>
  
  <pre><code>@SpringBootApplication
  public class MainApp {
     public static void main(String[] args) {
        SpringApplication.run(MainApp.class, args);
  }
  </code></pre>
  
  <p>This didn't work as its the main method.</p>
  
  <pre><code>@Value("${hello.world}")
  public static String helloWorld;
  </code></pre>
  
  <p>Maybe its possible to load by</p>
  
  <pre><code>  Properties prop = new Properties();
  
      // load a properties file
      prop.load(new FileInputStream(filePath));
  </code></pre>
  
  <p>Is there any other better way to get the properties using Spring in the main method of SpringBoot before  SpringApplication.run</p>