title: How do I get the itemWriter to create the files?
body: <p>My ItemWriter is not writing any files. After debug it stops at ItemProcessor. My project should receive information from the Mongo DB then read it, process it, then create .txt files and store the information in said file. What am I doing wrong or what am I missing?</p>
  
  <p>BatchConfig:</p>
  
  <pre><code>   @Configuration
     @EnableBatchProcessing
     public class BatchConfig {
  private static final Logger LOG =LoggerFactory.getLogger(BatchConfig.class);
  
  @Autowired
  private JobBuilderFactory jobBuilderFactory;
  @Autowired
  private StepBuilderFactory stepBuilderFactory;
  
  @Autowired
  private PaymentPortalJobListener listener;
  @Autowired
  private MongoTemplate mongoTemplate;
  
  @Bean
  public MongoItemReader&lt;PaymentAudit&gt; mongoReader() throws 
  UnexpectedInputException, ParseException {
      LOG.info("Inside Mongo Item Reader Method");
      MongoItemReader&lt;PaymentAudit&gt; reader = new MongoItemReader&lt;PaymentAudit&gt; 
   ();
      reader.setTemplate(mongoTemplate);
      reader.setCollection("paymentAudit");
      reader.setTargetType((Class&lt;? extends PaymentAudit&gt;) 
      PaymentAudit.class);
      reader.setFields("{rxFname, rxLname}");
      reader.setQuery("{rxFname, rxLname}");
      Map&lt;String, Sort.Direction&gt; sorts = new HashMap&lt;String, Sort.Direction&gt; 
      (1);
      sorts.put("rxFName", Sort.Direction.ASC);
      reader.setSort(sorts);
      return reader;
    }
  
   @Bean
   public ItemProcessor&lt;PaymentAudit, PaymentAudit&gt; processor() {
      LOG.info("Inside Processor Method");
      return new PaymentPortalNOSQLProcessor();
  
   }
  
  @Bean
  public ItemWriter&lt;PaymentAudit&gt; writer() {
      LOG.info("Inside Writer Method");
      return new PaymentPortalNOSQLWriter();
  }
  
  @Bean
  Job job(JobBuilderFactory jbf, StepBuilderFactory sbf, 
   PaymentPortalNOSQLProcessor processor,
          ItemWriter&lt;? super PaymentAudit&gt; writer) {
  
      Step s1 = sbf.get("local").&lt;PaymentAudit, 
   PaymentAudit&gt;chunk(100).reader(mongoReader()).processor(processor)
              .writer(writer).listener(listener).build();
  
      return jbf.get("etl").incrementer(new 
    RunIdIncrementer()).start(s1).build();
  }
  
  }
  </code></pre>
  
  <p>PaymentPortalNOSQLWriter:</p>
  
  <pre><code> @Bean
   public FileWriter Mongowriter(){
      FileWriter writer = null;
      try {
          String fullPath =OUTPUT_FILENAME + FILENAME_EXTN;
          writer = new FileWriter(fullPath);
          writer.write("[");
      } catch (IOException e) {
          LOG.error("Exception occured in MongoWriter() :: 
      ApplicationConfiguration", e);
      }
      return writer;
    }
  
    @Override
    public void write(List items) throws Exception {
  
  
    } 
  
  
   }
  </code></pre>
  
  <p>PaymentPortalJobListener</p>
  
  <pre><code> @Autowired
  private ApplicationContext appContext;
  
  
    @Override
    public void beforeStep(StepExecution stepExecution) {
        long checkpoint = System.currentTimeMillis();
      LOG.info("ExamResult Job starts at : {} " , checkpoint / (1_000 * 1.0));
    }
  
    @Override
     public ExitStatus afterStep(StepExecution stepExecution) {
      if(stepExecution.getStatus() == BatchStatus.COMPLETED){
          LOG.info("ExamResult job completed successfully");
          try {
              FileWriter saveWriter = 
     (FileWriter)appContext.getBean("paymentPortalWriter");
              saveWriter.write("{}");
              saveWriter.flush();
              saveWriter.close();
          } catch (BeansException | IOException e) {
              LOG.error("Exception occured in afterStep() :: PaymentPortal", 
     e);
          }
      }
      return stepExecution.getExitStatus();
  }
  }
  </code></pre>
  
  <p>PaymentPortalNOSQLProcessor:</p>
  
  <pre><code>  public class PaymentPortalNOSQLProcessor implements 
   ItemProcessor&lt;PaymentAudit, PaymentAudit&gt; {
   private static final Logger LOG = 
   LoggerFactory.getLogger(PaymentPortalNOSQLProcessor.class);
  
  @Override
  public PaymentAudit process(PaymentAudit bean) throws Exception {
      LOG.debug("Processor method");
      return bean;
  
  }
  }
  </code></pre>
  
  <p>Gradle Build:</p>
  
  <pre><code>   buildscript {
  ext {
      springBootVersion = '2.0.5.RELEASE'
  }
  repositories {
      mavenCentral()
  }
  dependencies {
      classpath("org.springframework.boot:spring-boot-gradle- 
  plugin:${springBootVersion}")
  }
   }
  
   apply plugin: 'java'
   apply plugin: 'eclipse'
   apply plugin: 'org.springframework.boot'
   apply plugin: 'io.spring.dependency-management'
  
   group = 'com.example'
   version = '0.0.1-SNAPSHOT'
   sourceCompatibility = 1.8
  
   repositories {
  mavenCentral()
   }
  
  
  dependencies {
  compile('org.springframework.boot:spring-boot-starter-batch')
  compile('org.springframework.boot:spring-boot-starter-data-mongodb')
  
  //compile("org.hsqldb:hsqldb")
  
  
  
  compile('org.springframework.boot:spring-boot-devtools')
  compileOnly('org.projectlombok:lombok')
  compile group:'org.springframework.boot', name:'spring-boot-configuration- 
   processor'
  testImplementation('org.springframework.boot:spring-boot-starter-test')
  testImplementation('org.springframework.batch:spring-batch-test')
  // https://mvnrepository.com/artifact/com.h2database/h2
  //testCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
  
   }
  </code></pre>