What is Spring's Minimum Dependencies for Depe

2019-04-30 02:46发布

What are the minimum dependencies required to just use Spring's dependency injection (core framework only)? I'm using Spring for a standalone application, and I'd like to minimize the number of dependencies that I have to ship with the application.

I suppose I could systematically remove a Jar and see if the application breaks, but it would be much better if someone had a definitive answer.

Oh, and I'm using Spring 2.5.

2条回答
闹够了就滚
2楼-- · 2019-04-30 03:02

I think for today it is more convenient to use spring-boot, coming out of this idea my suggestion is to use "org.springframework.boot:spring-boot-starter"

below is dependencies tree:

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
查看更多
劫难
3楼-- · 2019-04-30 03:14

Check out the readme.txt that comes with the download of Spring 2.5.

Assuming you don't have AOP, JDBC, Transactions, or ORM, then your best bet is probably:

  • spring-core
  • spring-beans
  • spring-context
查看更多
登录 后发表回答