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
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
3
Answers
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:
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
It’s code in jar
spring-boot-autoconfigure
, in packageorg.springframework.boot.autoconfigure.data.redis
, the core class isRedisAutoConfiguration