This workbench project demonstrates how to setup a Spring Boot Starter and Auto Configuration as a project using Gradle, Java and Kotlin.
It includes the following sub-projects:
-
greet-library
: A sample library that is configured by the Starter and is mandatory for all consumer applications. It is therefore automatically included as a transitive dependency. -
greet-opt-library
: A sample library that is configured by the Starter and is optional for consumer applications. It has to be explicitly declared as a dependency by the consumer. -
gradle-workbench-spring-boot-autoconfigure
: The autoconfiguration implementation. It shows how to handle classes that may not be present on the classpath when the consumer is running. -
gradle-workbench-spring-boot-autoconfigure-kt
: The autoconfiguration implemented in Kotlin. -
gradle-workbench-spring-boot-starter
: The Spring Boot Starter that is declared as a dependency by the consumer and references all mandatory transitive dependencies. -
gradle-workbench-spring-boot-starter-kt
: The Spring Boot Starter referencing the Kotlin implementation of the autoconfiguration. -
sample-application-simple
: A cli Spring Boot application demonstrating the usage of the Starter without using the optional library. -
sample-application-optional
: A cli Spring Boot application demonstrating the usage of the Starter including the optional library. -
integration-test
: A module demonstrating how to write integration tests that utilize the auto-configuration implementation.
The libraries, starter and autoconfiguration are build as Gradle multi-project. The sample applications are separate Gradle projects.
The starter project has to be build and published to the local maven repository once before building the sample applications.
To build the starter, auto-configuration and library projects and publish them to the local maven repository use ./gradlew clean build publishToMavenLocal
.
In either the sample-application-simple
or sample-application-optional
folder use ./gradlew clean bootRun
to start the application.
See the Spring Boot Documentation for more information