DEV Community

Discussion on: How 4 lines of Java code end up in 518772 lines in production.

Collapse
 
elmuerte profile image
Michiel Hendriks • Edited

Problem with many of those Spring Boot Starter is that they include a lot of dependencies you might not even use. It gets even worse when you also use an alternative start package. For example spring-boot-starter-jetty next to your spring-boot-starter-web. If you don't exclude spring-boot-starter-tomcat from spring-boot-starter-web you have even more dependency cruft.

The way Spring organized the Spring Boot packages you basically have two huge packages which have a lot of optional dependencies which get auto-magically activated when you have an other dependency included (this is all in spring-boot-autoconfigure). Those starter packages don't contain any code. If spring-boot-autoconfigure was split up in small packages for each supported library, then it would end result would be much smaller.

Another popular obese library is Google's Guava. As a library it's poorly designed, and also quite a dependency hell with their really active removal of deprecated features. The library itself is a massive 2.7MiB. In most cases people only use a really small subset of this library.