Skip to content

Commit d067cc6

Browse files
committed
Merge branch '2.2.x'
Closes gh-21367
2 parents 228703f + c3eaa6d commit d067cc6

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

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

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

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

7785-
* The `autoconfigure` module that contains the auto-configuration code.
7786-
* The `starter` module that provides a dependency to the `autoconfigure` module as well as the library and any additional dependencies that are typically useful.
7787+
Concretely, a custom starter can contain the following:
7788+
7789+
* The `autoconfigure` module that contains the auto-configuration code for "acme".
7790+
* The `starter` module that provides a dependency to the `autoconfigure` module as well as "acme" and any additional dependencies that are typically useful.
77877791
In a nutshell, adding the starter should provide everything needed to start using that library.
77887792

7789-
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.
7793+
This separation in two modules is in no way necessary.
7794+
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.
7795+
Besides, you have the ability to craft a starter that provides an opinion about those optional dependencies.
7796+
At the same time, others can rely only on the `autoconfigure` module and craft their own starter with different opinions.
7797+
7798+
If the auto-configuration is relatively straightforward and does not have optional feature, merging the two modules in the starter is definitely an option.
77907799

77917800

77927801

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

77997808
As a rule of thumb, you should name a combined module after the starter.
7800-
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`.
7809+
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`.
78017810
If you only have one module that combines the two, name it `acme-spring-boot-starter`.
78027811

78037812

0 commit comments

Comments
 (0)