Spring Boot: Step to register bootrun as gradle task

When we use Spring Boot, bootrun is automatically registered as a Gradle task. I followed its steps, how it is registered

The codes I posted here is the code in the master branch of each repository on .

The task is added when the plugin is added

bootrun can be used when the Spring Boot is added into build.gradle.

When loading Spring Boot plugin with apply plugin description, SpringBootPlugin‘s execute is executed. And JavaPluginAction plugin is added in it.

There, KotlinPluginAction will add Kotlin Gradle plugin.

JavaPluginAction is loaded as plugin, so the execute function in it will be executed. JavaPluginAction implements PluginApplicationAction interface. PluginApplicationAction is the derived interface from Action<Project>, which has a object with one additional method to Action<Project>.

この中の configureBootRunTask で タスク bootrun が追加されます。

What is BootRun?

bootrun is customized gradle run for Spring Boot, which becomes available by apply plugin: 'application'. BootRun is derived from JavaExec, and not so different from JavaExec.