How to pass Debug Flag to Spring Boot via Gradle bootRun to view AutoConfigure information

Shaun F picture Shaun F · Dec 4, 2015 · Viewed 9k times · Source

So i'm working on the Consuming Rest Services with Spring Boot Tutorial and trying to figure out how it's wiring the AutoConfigure with Jackson and RestTemplate.

I have been told I can pass the --debug flag to Spring Boot. This would make Spring Boot emit it's Auto Configuration information.

Currently I'm running this via the gradle bootRun task that comes with the Spring Boot gradle plugin. This is being run via an IntelliJ Run Configuration in this image.

IntelliJ Run Configuration

How do I pass a --debug flag so that Spring Boot picks it up. If I put this in the VM Options, gradle picks it up and starts emitting all of it's information (which I don't want).

Answer

Stanislav picture Stanislav · Dec 4, 2015

I suppose, to do that, you have to configure your bootRun task, something like:

bootRun {
  if ( project.hasProperty('springDebug') ) {
      args '--debug'
  }
}

Then you can provide a springDebug flag for your build to run the application in debug mode and not affecting the gradle debug.