Spring-boot has the following maven dependencies around org.apache.httpcomponents
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>${httpasyncclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient.version}</version>
</dependency>
However I don't have access to anything org.apache.http related in my codebase unless I add the extra dependency myself.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
Why is this? Isn't this the same as adding a dependency twice?
The artifacts are declared in the dependencyManagement section of the spring-boot-dependencies pom.
Meaning when you inherit from the spring boot starter, you can declare you want to use any of the dependencies managed by it. Notice you don't need to provide a version of the httpclient. This is because Spring has so nicely managed it for you, hence dependencyManagement. So it is not the same thing as declaring it twice.
More info here http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-maven-parent-pom
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With