Reputation: 21
I find the jar only three common files, no java file, no pom.xml file. How it works? I'am confused, thanks~
➜ jar -tf spring-boot-starter-data-redis-2.5.1.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/LICENSE.txt
META-INF/NOTICE.txt
Upvotes: 2
Views: 2881
Reputation: 431
The package also includes a pom.xml which defines some dependencies on other projects like spring-data-redis, lettuce-core. These dependencies will be included in your build process. So there's no actual code in the jar.
Example from the spring-boot-starter-data-redis 2.0.6-RELEASE pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.0.6.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.0.11.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.0.5.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
Upvotes: 3
Reputation: 21
It's code in jar spring-boot-autoconfigure
, in package org.springframework.boot.autoconfigure.data.redis
, the core class is RedisAutoConfiguration
Upvotes: 1
Reputation: 1705
As Luc said, if you look inside the artifact you'll see a POM https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-data-redis/2.5.2/spring-boot-starter-data-redis-2.5.2.pom that brings all the needed dependencies. Baeldung has a good article on how starters work https://www.baeldung.com/spring-boot-starters
Upvotes: 1