Spring web app tutorial extras: BOM dependency

How to use Maven Spring Framework BOM dependency?

If you use different Spring frameworks like Spring Security and Spring Data JPA, you will notice, that each version of each framework depends on some version of base Spring Framework libraries.

This can create a major problem, because you can easily mismatch versions. This will result in a nasty errors during application startup.

How to resolve this issue? You can either add all Spring dependencies in pom.xml and ensure that in classpath are correct Spring versions, or you can use Spring bom (Bill of Materials) dependency:


If you use this dependency, then you don't specify the Spring version inside other Spring Framework dependencies and this bom dependency will take care of managing correct Spring Framework versions, so you won't have to do it manually.