title: The value to the property that is set in the spring bean is getting null when using
body: <p>This is my beans.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
                              http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                              http://www.springframework.org/schema/context
                              http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
  &lt;context:property-placeholder location="file:/C:/local/fts.properties" /&gt;
  
      &lt;bean id="shredFilesUnderTimePeriod" class="com.qvc.supplychain.app.delete.ShredFilesUnderTimePeriod"&gt;
          &lt;property name="fileLocation" value="${LOCAL_FILE_DIR}/FileTransferIntegrationServices/ftpArchive"/&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and this is my application class:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.concurrent.TimeUnit;
  
  import org.apache.log4j.Logger;
  
  public class ShredFilesUnderTimePeriod {
  
      public Logger logger = Logger.getLogger(this.getClass());
  
      private final static int DAYS_LIMIT = 2;
  
      private String fileLocation;
  
      private static long currentTimeInMillis;
  
      public ShredFilesUnderTimePeriod() {
          shredFilesFromDirectory();
      }
  
      private void shredFilesFromDirectory() {
          logger.info("Deleting the obsolete files");
          currentTimeInMillis = Calendar.getInstance().getTimeInMillis();
          Date currentDate = new Date(currentTimeInMillis);
          logger.info("Today's date: " + "" + currentDate + "\n");
          try {
              File loadFilesFromTheDirectory = new File(fileLocation);
              if (!loadFilesFromTheDirectory.isDirectory()) {
                  throw new FileNotFoundException("Is not a directory");
              } else {
                  for (File file : loadFilesFromTheDirectory.listFiles()) {
                      if (file.isDirectory()) {
                          for (File subDirectoryFile : file.listFiles()) {
                              deleteFile(subDirectoryFile);
                          }
                      } else {
                          deleteFile(file);
                      }
                  }
                  logger.info("Obsolete files deletion got completed");
              }
  
          } catch (FileNotFoundException eMsg) {
              eMsg.printStackTrace();
          } catch (Exception eMsg) {
              logger.error("Error while shredding obsolete files. Cause: " + eMsg.getStackTrace());
              System.out.println("Error while shredding obsolete files. Cause: " + eMsg.getStackTrace());
          } finally {
              //System.exit(0);
          }
      }
  
      private void deleteFile(File file) {
          long totalNumberOfDays = 0L;
          Date fileCreatedDate = null;
          try {
              if (file.isDirectory()) {
                  throw new FileNotFoundException("Is not a directory");
              }
              fileCreatedDate = new Date(file.lastModified());
              logger.info(file.getName() + " file is created or last modified on: " + fileCreatedDate
                      + ", total number of days present: " + totalNumberOfDays);
              totalNumberOfDays = TimeUnit.DAYS.convert(currentTimeInMillis - fileCreatedDate.getTime(),
                      TimeUnit.MILLISECONDS);
              if (totalNumberOfDays &gt; DAYS_LIMIT) {
                  file.delete();
              }
          } catch (FileNotFoundException eMsg) {
              eMsg.printStackTrace();
          } catch (Exception eMsg) {
              logger.error("Error while shredding obsolete files. Cause: " + eMsg.getStackTrace());
          }
      }
  
      public String getFileLocation() {
          return fileLocation;
      }
  
      public void setFileLocation(String fileLocation) {
          this.fileLocation = fileLocation;
      }
  
  }
  </code></pre>
  
  <p>now the problem is the fts.properties file is getting loaded but the value to the property: "fileLocation" is not getting set. I am getting puzzled that even after I tried giving a direct value, its still showing null while debugging. I wish to know where it is going wrong. I want this field/property's value to be set dynamically. Any help is appreciated.</p>