title: spring batch database connection failure is not returning proper exit status
body: <p>I have gone through few posts related to the similar issue, i am calling spring batch application through shell script and getting the exit status.Everything works fine on successful execution. ExitStatus gets populated as 0. However if there is any database error(to create database error i gave the wrong port of database) then ExitStatus is being returned as empty. Code is below</p>
  
  <p>I have referred below posts and implemented similarly</p>
  
  <p><a href="https://stackoverflow.com/questions/40427590/make-a-spring-batch-job-exit-with-non-zero-code-if-an-exception-is-thrown">Make a spring-batch job exit with non-zero code if an exception is thrown</a></p>
  
  <p><a href="https://stackoverflow.com/questions/50931217/spring-batch-return-custom-process-exit-code">Spring batch return custom process exit code</a></p>
  
  <p>Shell Script:
      java -jar $JOBDIR/lib/feed*.jar</p>
  
  <pre><code>result=$?
      echo $result            
  </code></pre>
  
  <p>Java:</p>
  
  <pre><code> public static void main(String[] args) {
         ConfigurableApplicationContext context 
                    =SpringApplication.run(App.class, args);
  
      int exitCode = SpringApplication.exit(context);
      System.out.print("Exit code is" + exitCode);
      System.exit(exitCode);
    }
  
      @Primary
  @Bean(destroyMethod = "")
  public DataSource dataSource() throws Exception {
        return BatchDataSource.create(url, user, password);
      }
  </code></pre>
  
  <p>in case of database error it is not even reaching end of the main method System.exit(exitCode); Can any one guide me what is wrong??</p>