title: In Gradle build, start Spring boot application, run tests and then stop the Spring boot application
body: <p>With my Gradle build I want to start my Spring Boot application, run some tests and then shutdown the Spring boot application. First I try just to start the server and then shutdown, leaving out the tests for now.</p>
  
  <p>Part of my build.gradle file looks like this</p>
  
  <pre><code>bootRun {
      systemProperties = System.properties
  }
  
  task shutdown(type: org._10ne.gradle.rest.RestTask) {
      httpMethod = 'post'
      uri = 'http://localhost:8080/shutdown'
  }
  
  task integrationTest() {
      dependsOn bootRun
      finalizedBy shutdown
  }
  </code></pre>
  
  <p>I start the build from the command line like this</p>
  
  <pre><code>gradle integrationTest -Dendpoints.shutdown.enabled=true
  </code></pre>
  
  <p>The build starts the Spring Boot application but it is not proceeding (of course) to the shutdown task. I can run the shutdown task separately and it will take down the Spring Boot app.</p>
  
  <p>But, how can I get the server to run and shutdown in the same build?</p>