liveBook · Manning

Spring Boot starter

As explained in Spring in Action, Sixth Edition

A Spring Boot starter is a dependency descriptor that transitively brings together libraries needed for a particular application capability.

A Spring Boot starter is a dependency you add for a capability, such as web development, persistence, security, messaging, or monitoring. It typically contains little or no library code itself. Instead, it brings the needed libraries into your project transitively. section 1.2.2 section 9.1.1 section 15.1

Add a starter to your Maven pom.xml, or select its capability in Spring Initializr. This keeps the build shorter than listing every library separately. Spring Boot manages compatible versions of the libraries brought in by a starter, so you generally choose a Spring Boot version rather than versions for each library. section 1.2.2 section 5.1

Add security with one dependency

Adding spring-boot-starter-security puts Spring Security on the classpath. On startup, autoconfiguration supplies basic security: visiting a page prompts for a login, and the generated password appears in the application log. The starter gets you running; you can then configure security to suit the application. section 5.1

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

The Maven dependency entry for spring-boot-starter-security shows the small build change that enables basic security. section 5.1

Choose the starter that matches the implementation you intend to use. For example, spring-boot-starter-jdbc makes JdbcTemplate available; switching to Spring Data JDBC means replacing that starter with spring-boot-starter-data-jdbc. Keep the separate H2 dependency if the application still uses H2. section 3.1.2 section 3.2.1

A starter does not eliminate every other setup step. The JPA starter brings in Hibernate by default, but another JPA implementation requires a dependency exclusion and replacement. The Cassandra starter triggers repository autoconfiguration, yet a running Cassandra database and some configuration are still needed. section 3.3.1 section 4.1.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines transitive dependencies and compatible versions, then demonstrates starter selection, replacement, and an implementation override.
Examples
Shows Maven entries for JDBC, JPA, Cassandra, MongoDB, security, JMS, and Actuator starters.
What it assumes
Assumes a Spring Boot project and introduces starter dependencies through Maven build entries and Spring Initializr selections.
What you can do after
Operate/configure it by adding or replacing capability-specific Maven starters and retaining separate dependencies needed by the application.
How it connects
Connects Maven dependencies and Spring Initializr to autoconfiguration, Spring Data repositories, and Spring Security.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.