You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
7784
7786
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.
7787
7791
In a nutshell, adding the starter should provide everything needed to start using that library.
7788
7792
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.
7790
7799
7791
7800
7792
7801
@@ -7797,7 +7806,7 @@ Do not start your module names with `spring-boot`, even if you use a different M
7797
7806
We may offer official support for the thing you auto-configure in the future.
7798
7807
7799
7808
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`.
7801
7810
If you only have one module that combines the two, name it `acme-spring-boot-starter`.
0 commit comments