I just started out learning spring boot and I can immediately see that there are two types of dependencies, at least those I have encountered,those labelled starter and those that are not. My question is what is the difference and when should I use one over the other.
CodePudding user response:
The short answer is that those "starter" packages are autoconfigurable. They don't need any particular configuration to work out of the box, but you may configure them to fit your particular needs, which makes them perfect for the Spring Boot's focus on simplicity.
Those dependencies are thought to be used with Spring Boot, but the others were/are there for Spring (non Boot) projects. I haven't really dived in to them to pinpoint specific differences, but they pretty much work the same (I've successfuly build and run projects with autoconfigurable dependencies in Spring non Boot projects, but take that with a grain of salt, as those were practice projects in controlled environments).
Ideally you'd want to use 'regular' dependencies with non Boot projects and you'd want to use 'starters' for Boot projects, but it is not a hard rule. Just make sure to use properly mantained dependencies.
CodePudding user response:
The starter dependencies are just dependencies that contain a bunch of transitive dependencies. Try to Ctrl Click them, you will see what other dependencies they contain.
Spring has packaged these dependencies to make your life easier and make you able to add all common dependencies needed to do certain tasks.
This is all based on their motto of convention over configuration
.