Skip to content

Commit c3eaa6d

Browse files
committed
Merge branch '2.1.x' into 2.2.x
Closes gh-21366
2 parents 0dfca92 + efc9978 commit c3eaa6d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7489,13 +7489,22 @@ include::{test-examples}/autoconfigure/UserServiceAutoConfigurationTests.java[ta
74897489

74907490
[[boot-features-custom-starter]]
74917491
=== Creating Your Own Starter
7492-
A full Spring Boot starter for a library may contain the following components:
7492+
A typical Spring Boot starter contains code to auto-configure and customize the infrastructure of a given technology, let's call that "acme".
7493+
To make it easily extensible, a number of configuration keys in a dedicated namespace can be exposed to the environment.
7494+
Finally, a single "starter" dependency is provided to help users get started as easily as possible.
74937495

7494-
* The `autoconfigure` module that contains the auto-configuration code.
7495-
* The `starter` module that provides a dependency to the `autoconfigure` module as well as the library and any additional dependencies that are typically useful.
7496+
Concretely, a custom starter can contain the following:
7497+
7498+
* The `autoconfigure` module that contains the auto-configuration code for "acme".
7499+
* The `starter` module that provides a dependency to the `autoconfigure` module as well as "acme" and any additional dependencies that are typically useful.
74967500
In a nutshell, adding the starter should provide everything needed to start using that library.
74977501

7498-
TIP: You may combine the auto-configuration code and the dependency management in a single module if you do not need to separate those two concerns.
7502+
This separation in two modules is in no way necessary.
7503+
If "acme" has several flavours, options or optional features, then it is better to separate the auto-configuration as you can clearly express the fact some features are optional.
7504+
Besides, you have the ability to craft a starter that provides an opinion about those optional dependencies.
7505+
At the same time, others can rely only on the `autoconfigure` module and craft their own starter with different opinions.
7506+
7507+
If the auto-configuration is relatively straightforward and does not have optional feature, merging the two modules in the starter is definitely an option.
74997508

75007509

75017510

@@ -7506,7 +7515,7 @@ Do not start your module names with `spring-boot`, even if you use a different M
75067515
We may offer official support for the thing you auto-configure in the future.
75077516

75087517
As a rule of thumb, you should name a combined module after the starter.
7509-
For example, assume that you are creating a starter for "acme" and that you name the auto-configure module `acme-spring-boot-autoconfigure` and the starter `acme-spring-boot-starter`.
7518+
For example, assume that you are creating a starter for "acme" and that you name the auto-configure module `acme-spring-boot` and the starter `acme-spring-boot-starter`.
75107519
If you only have one module that combines the two, name it `acme-spring-boot-starter`.
75117520

75127521

0 commit comments

Comments
 (0)