title: Spring-Boot Configuration for suppressing BatchDataInitializer
body: <p>I am using Spring-boot 0.5.0.M6 with Spring-Batch. Configuration has by using @EnableBatchProcessing with datasource etc configured in application.properties.</p>
  
  <p>During first run of the application, everything works fine but after I stop the application and restart application, following error is seen</p>
  
  <pre><code>org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)]; Duplicate entry '1' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY'
      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:659)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:908)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:969)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:974)
  </code></pre>
  
  <p>When digging down, i had observed following lines in logs</p>
  
  <pre><code>2013-12-06 12:12:37 INFO  ResourceDatabasePopulator:162 - Executing SQL script from class path resource [org/springframework/batch/core/schema-mysql.sql]
  2013-12-06 12:12:37 INFO  ResourceDatabasePopulator:217 - Done executing SQL script from class path resource [org/springframework/batch/core/schema-mysql.sql] in 13 ms.
  </code></pre>
  
  <p>Root problem over here was schema-drop-mysql.sql was not triggered by schema-mysql.sql was triggered, thereby creating two entries in BATCH_JOB_SEQ.</p>
  
  <p>For resolution of the same, I have added </p>
  
  <pre><code>@EnableAutoConfiguration(exclude={BatchAutoConfiguration.class})
  </code></pre>
  
  <p>However due to this I need to execute schema-mysql.sql explicitly, which as of now is ok, but would be problem when spring-batch version would be updated with updates in schema</p>
  
  <p>Hence have couple of questions:
  1. How to autoconfigure batch for even executing schema-drop-mysql.sql  before schema-mysql.sql?
  2. is there way to configure this BatchDatabaseInitializer to run kind of "update" mode? </p>
  
  <p>Regards</p>