title: Change Spring Boot project to inherit custom dependency management
body: <p>I have a small Spring Boot application which I must adapt to use a custom parent. Google finds lots of examples of how to migrate <em>to</em> Spring Boot, but I am at a loss as to migrate <em>from</em> Spring Boot (which I barely know to begin with).</p>
  
  <h3>The reasons</h3>
  
  <p>To make things short, this application was developed as a kind of a proof-of-concept and the developer chose state-of-the-art technologies.</p>
  
  <p>Now, this application will keep on living and we need to integrate it in our framework. As a Maven project, it should therefore inherit one of our common parent, though it is my understanding Spring Boot projects should inherit from the Spring Boot starter parent POM.</p>
  
  <p><strong>[Edit]</strong> I was incorrect: it is possible to <a href="http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-maven-without-a-parent">use Spring Boot without the parent POM</a>. Removing Spring Boot is therefore not an obligation, but our parent POM includes its own version management, which obliges me to override several versions included in the starter.</p>
  
  <h3>Why we need to inherit from our parent</h3>
  
  <p>We have an enterprise framework used across all our projects. To make things easier, we manage versions of many frameworks in our parent POM. Some examples where these versions conflict with the ones from spring-boot-dependencies in our little batch project:</p>
  
  <ul>
  <li>Spring framework (in-house: 3.2.4; Spring Boot 1.2.2: 4.1.5)</li>
  <li>Spring Batch (ih: 2.2.0; sb: 3.0.3)</li>
  <li>Velocity (ih: 1.5; sb: 1.7)</li>
  <li>Junit (ih: 4.11; sb: 4.12)</li>
  <li>... (we manage about 90 versions)</li>
  </ul>
  
  <p>I am obviously not at liberty to upgrade those versions. Please keep in mind this framework is used across many projects and any change could have dramatic and uncontrolled consequences.</p>
  
  <h3>Additional context</h3>
  
  <p>The objective is to get a little Spring batch application. It must take some input from the command line and return a <code>12</code> exit code if execution fails. Below is the core of the launcher but I am open to any better way to do it.</p>
  
  <h3>Our batch launcher class</h3>
  
  <p>If totally abandoning Spring Boot, I would need to adapt this launcher class but, being mostly used to XML Spring contexts, I find this a bit difficult.</p>
  
  <pre><code>// ...
  import org.springframework.batch.core.ExitStatus;
  import org.springframework.batch.core.JobExecution;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.context.ConfigurableApplicationContext;
  import org.springframework.context.annotation.ComponentScan;
  
  @ComponentScan("my.config.package")
  @EnableAutoConfiguration
  public class Application {
  
      public static void main(String[] args) {
          // ...
          SpringApplication app = new SpringApplication(Application.class);
          app.setWebEnvironment(false);
          final Map&lt;String, Object&gt; maps = new HashMap&lt;&gt;();
          maps.put("input", "file:" + inputPath);
          app.setDefaultProperties(maps);
          ConfigurableApplicationContext ctx = app.run(args);
  
          JobExecutionSavingListener listener = ctx.getBean(JobExecutionSavingListener.class);
  
          final JobExecution jobExecution = listener.getJobExecution();
          if (jobExecution.getExitStatus() != ExitStatus.COMPLETED) {
              System.exit(12);
              return;
          }
          System.exit(0);
      }
  }
  </code></pre>
  
  <h3>The question</h3>
  
  <p><strong>What is the best way to change my code to adapt my Spring Batch application so that I could use my own Maven parent?</strong></p>