JavaSheriff
JavaSheriff

Reputation: 7665

Maven Spring boot dependency vs Maven Spring dependency

What is the difference between the way I declare the two dependency?
My project is a spring boot project...
This one I downloaded from Spring Initializer:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency>

This one is from mvnrepository.com:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-ldap</artifactId>
    <version>3.1.0.RELEASE</version>
</dependency>

Update, this article shows a third way:

<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-ldap</artifactId>
</dependency>

Upvotes: 1

Views: 310

Answers (1)

Ortomala Lokni
Ortomala Lokni

Reputation: 62535

The first one is a Spring Boot starter. According to the documentation:

Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop shop for all the Spring and related technologies that you need without having to hunt through sample code and copy-paste loads of dependency descriptors.

The pom.xml of spring-boot-starter-data-ldap contains the following dependency definitions:

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-ldap</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
</dependencies>

The second one: spring-security-ldap is the artifact present in maven central, corresponding to the Spring LDAP project.

Upvotes: 1

Related Questions