Two Same Maven Dependencies (spring boot starters) with "provided" and "compile" scopes

24 views Asked by At

I have two maven projects. In first project I import two same dependencies that spring boot starters. For example:

<dependencies>
    <dependency>
        <groupId>org.example</groupId>
        <artifactId>example-spring-boot-starter</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.example</groupId>
        <artifactId>example-spring-boot-starter</artifactId>
    </dependency>
</dependencies>

Second dependency has compile scope (by default). In second project I import first project as dependency. When I run second project (spring boot application) and use some classes from this dependency than autoconfiguration works. But When I don't use some classes than autoconfiguration doesn't work. Why it works this way? I expect autoconfiguration will work always in this cases. It maybe feature

0

There are 0 answers