Spring Boot: starter modules – do i need to keep them?

Spring Boot: starter modules – do i need to keep them?

The intention of Spring Starter modules is not necessarily intended to be aimed at being replaced by manually defining your dependencies. In fact, its more the opposite, as the set of dependencies defined in starters are tested to work as expected as it provides an opinionated set.

The pattern laid out by Spring Boot is two fold, autoconfigure modules and starter modules:

  • Autoconfigure modules that generally do not, unless necessary, require dependencies downstream. Autoconfigure modules will compile against one or many modules, and then enable configurations within your application context based on rules generally governed by what libraries and components are available at context initialization. This is useful as it provides reasonable baseline configurations that can be used in a variety of scenarios, without enforcing what particular libraries/vendors downstream consumers must use. However, because they are intended to be used in a variety of scenarios, it is incumbent upon you as the consumer to ensure you have a valid context.
  • Starter modules are complimentary to autoconfigure modules. They provide an opinionated set of dependencies downstream, along with autoconfigure dependencies, to allow consumers to get started. Generally, but not necessarily, starter modules themselves are fairly empty and often do not contain any classes, as their main purpose is to just provide a POM that can be used for transitive dependencies.

Although your query is not about developing custom auto-configuration, the Spring Boot documentation regarding developing your own auto-configuration does a good job explaining the pattern.

Traditionally when we develop a Spring application, we need to include all the required dependencies (spring or other framework jar) by ourself. Starter is intended to minimize such configuration . It does not have any codes or logic inside . You can think that it is just a configuration setting which pre-defines some dependencies. Including a starter will automatically include all of the dependencies defined by this starter to your project thanks to the build system (e.g Maven) s transitive dependencies features.

So you can see that starter provides one of the SpringBoot philosophy, which enable developer to create a Spring app that can just run quickly without much configuration , it definitely will not be replaced by the Spring.

Spring Boot: starter modules – do i need to keep them?

Leave a Reply

Your email address will not be published. Required fields are marked *