title: How to disable @PostConstruct in Spring during Test
body: <p>Within a Spring Component I have a <code>@PostConstruct</code> statement. Similar to below:</p>
  
  <pre><code>@Singleton
  @Component("filelist")
  public class FileListService extends BaseService {
  
      private List listOfFiles = new Arrays.list();
  
      //some other functions
  
  
      @PostConstruct
      public void populate () {
  
          for (File f : FileUtils.listFiles(new File(SystemUtils.JAVA_IO_TMPDIR), new String[]{"txt"},true)){
              listOfFiles.add(f.getName());
          }   
      }
  
      @Override
      public long count() throws DataSourceException {
          return listOfFiles.size();
      }
  
      //  more methods .....
  }
  </code></pre>
  
  <p>During Unit tests I would not like to have the <code>@PostConstruct</code> function called, is there a way to telling Spring not to do post processing? Or is there a better Annotation for calling a initiation method on a class durning non-testing ?</p>