[英]What is Spring's Minimum Dependencies for Dependency Injection?
仅使用 Spring 的依赖注入(仅限核心框架)所需的最小依赖是什么? 我将 Spring 用于一个独立的应用程序,我想尽量减少我必须随应用程序一起提供的依赖项的数量。
我想我可以系统地删除一个 Jar 并查看应用程序是否中断,但如果有人有明确的答案会更好。
哦,我使用的是 Spring 2.5。
查看下载 Spring 2.5 附带的readme.txt
。
假设您没有 AOP、JDBC、事务或 ORM,那么您最好的选择可能是:
如果您使用的是 maven,那么 pom.xml 中只需要 spring-context,这取决于 aop、bean、核心、表达式和 asm
我认为今天使用spring-boot更方便,从这个想法出来我的建议是使用“org.springframework.boot:spring-boot-starter”
下面是依赖树:
compile - Dependencies for source set 'main' (deprecated, use 'implementation' instead).
\--- org.springframework.boot:spring-boot-starter:2.1.2.RELEASE
+--- org.springframework.boot:spring-boot:2.1.2.RELEASE
| +--- org.springframework:spring-core:5.1.4.RELEASE
| | \--- org.springframework:spring-jcl:5.1.4.RELEASE
| \--- org.springframework:spring-context:5.1.4.RELEASE
| +--- org.springframework:spring-aop:5.1.4.RELEASE
| | +--- org.springframework:spring-beans:5.1.4.RELEASE
| | | \--- org.springframework:spring-core:5.1.4.RELEASE (*)
| | \--- org.springframework:spring-core:5.1.4.RELEASE (*)
| +--- org.springframework:spring-beans:5.1.4.RELEASE (*)
| +--- org.springframework:spring-core:5.1.4.RELEASE (*)
| \--- org.springframework:spring-expression:5.1.4.RELEASE
| \--- org.springframework:spring-core:5.1.4.RELEASE (*)
+--- org.springframework.boot:spring-boot-autoconfigure:2.1.2.RELEASE
| \--- org.springframework.boot:spring-boot:2.1.2.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-logging:2.1.2.RELEASE
| +--- ch.qos.logback:logback-classic:1.2.3
| | +--- ch.qos.logback:logback-core:1.2.3
| | \--- org.slf4j:slf4j-api:1.7.25
| +--- org.apache.logging.log4j:log4j-to-slf4j:2.11.1
| | +--- org.slf4j:slf4j-api:1.7.25
| | \--- org.apache.logging.log4j:log4j-api:2.11.1
| \--- org.slf4j:jul-to-slf4j:1.7.25
| \--- org.slf4j:slf4j-api:1.7.25
+--- javax.annotation:javax.annotation-api:1.3.2
+--- org.springframework:spring-core:5.1.4.RELEASE (*)
\--- org.yaml:snakeyaml:1.23
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.