Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimum JARs for Spring 3.0 dependency injection

Similarly to this question regarding an earlier Spring version, what are the minimum dependencies required for an application to use Spring 3.0 dependency injection only? The application context will be configured by XML only. Spring depends on a logging framework, so assume I already include these JARs for logging:

  • jcl-over-slf4j.jar
  • logback-classic.jar
  • logback-core.jar
  • slf4j-api.jar
like image 633
Chin Huang Avatar asked Oct 29 '10 16:10

Chin Huang


People also ask

Which is the best dependency injection in Spring?

We can combine constructor-based and setter-based types of injection for the same bean. The Spring documentation recommends using constructor-based injection for mandatory dependencies, and setter-based injection for optional ones.

How many ways are there to achieve dependency injection in Spring?

There are two types of Spring Dependency Injection. They are: Setter Dependency Injection (SDI): This is the simpler of the two DI methods. In this, the DI will be injected with the help of setter and/or getter methods.

What is the limitation of constructor injection in Spring?

Constructor injection (from the definition) does not allow you to create circular dependencies between beans. This limitation is actually an advantage of constructor injection - Spring can resolve circular dependencies when setter injection is used without you even noticing.


2 Answers

As stated in another answer, maven is the true path. If; however, you choose to stray, then based on section "1.2.1 Core Container" of the Spring Reference I believe these to be the minimum jars for core spring functionality:

  • org.springframework.asm-3.0.4.RELEASE.jar
  • org.springframework.beans-3.0.4.RELEASE.jar
  • org.springframework.context-3.0.4.RELEASE.jar
  • org.springframework.core-3.0.4.RELEASE.jar
  • org.springframework.expression-3.0.4.RELEASE.jar

Edited: sorted the list, using wiki formatting.

Updated for Spring 3.2: It seems that asm is not part of the 3.2 distribution. Below is the list for Spring 3.2:

  • spring-beans-3.2.0.RELEASE.jar
  • spring-context-3.2.0.RELEASE.jar
  • spring-core-3.2.0.RELEASE.jar
  • spring-expression-3.2.0.RELEASE.jar
like image 105
DwB Avatar answered Oct 28 '22 00:10

DwB


the best - and reliable way - of establishing this is to create a maven project and add dependency for spring-core, spring-bundle and spring-context. when you build/install this project maven will do the needful.

like image 23
anirvan Avatar answered Oct 27 '22 23:10

anirvan