title: spring boot application properties not loaded
body: <p>I am trying to read application properties but which are not loaded by default.In Repository it tries to read yml file username but it is not getting the value for api.username but it is getting null value.Please help me to find where am missing the configuration.</p>
  
  <p><strong>Main:-</strong></p>
  
  <pre><code>@SpringBootApplication
  @EnableScheduling
  @EnableAutoConfiguration
  public class Application {
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p><strong>Spring Batch Processor call snippet in job:-</strong></p>
  
  <pre><code>@Bean
  public PersonItemProcessor processor() {
      return new PersonItemProcessor();
  }
  </code></pre>
  
  <p><strong>Spring Batch Processor:-</strong></p>
  
  <pre><code>@Component
  public class PersonItemProcessor implements ItemProcessor&lt;PersonDO,PersonDO&gt; {
  
      private static final Logger log = LoggerFactory.getLogger(PersonItemProcessor.class);
  
      @Override
      public PersonDO process(final PersonDO person) throws Exception {
          getService().printUserName(person.getQueueId());
          log.info(person + "");
          return person;
      }
  
      @Bean
      public SService getService(){
          return new SService();
      }
  
  }
  </code></pre>
  
  <p><strong>Spring Service:-</strong></p>
  
  <pre><code>@Service
  public class SService {
  
      public boolean printUserName(String password){
          return getSRepository().printUserName(password);
      }
  
      @Bean
      public SRepository getSRepository(){
          return new SRepository();
      }
  }
  </code></pre>
  
  <p><strong>Spring Repository:-</strong></p>
  
  <pre><code>@Repository
  public class SRepository {
  
      @Value("${api.username}")
      private String username;
  
      public boolean printUserName(String password){
          System.out.println("username:"+username+":password:"+password);
          return (username!=null?true:false);
      }
  }
  </code></pre>
  
  <p><strong>application.yml</strong></p>
  
  <pre><code>api:
   username: UserName1
  spring:
   batch:
    job:
     enabled: false
  </code></pre>
  
  <p><strong>Output:-</strong></p>
  
  <pre><code>username:null:password:password@123
  </code></pre>
  
  <p><strong>Update location of application.yml is src/main/resources</strong></p>