Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the minimum jars needed for spring to be used in a standalone application?

him i am using spring in a standalone application for Dependency injection, MessageSource & PropertyPlaceHolder support, Hibernate/JDBC support,unit testing, and i was wondering what are the minimum jars needed for above requirements, and if i can exclude some jars or dependencies form my current configuration, since i don't need the application size to be big as it's a standalone application, i need to make the application size as small as i can, here's the dependencies i am using right now:

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring.version}</version>
        </dependency>       

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>  
            <groupId>org.springframework</groupId>  
            <artifactId>spring-asm</artifactId>  
            <version>${spring.version}</version>  

        </dependency>

UPDATE:

After minimizing the dependencies to:

  1. spring-core.
  2. spring-beans.
  3. spring-context.
  4. spring-context-support.
  5. spring-expression.
  6. spring-jdbc.
  7. spring-orm.
  8. hibernate-entitymanager.
  9. validation-api.
  10. hibernate-validator.
  11. junit.
  12. commons-logging.
  13. slf4j-simple.
  14. log4j.
  15. derby.
  16. cglib.

i still see some jars which i am not sure if they are important to my requirements or not:

  1. activation-1.1.jar
  2. antlr-2.7.6.jar
  3. aopalliance-1.0.jar
  4. asm-3.3.1.jar
  5. commons-collections-3.1.jar
  6. dom4j-1.6.1.jar
  7. javassist-3.9.0.GA.jar
  8. jms-1.1.jar
  9. mail-1.4.jar
  10. spring-aop-3.0.5.RELEASE.jar
  11. spring-asm-3.0.5.RELEASE.jar
  12. spring-tx-3.0.5.RELEASE.jar
  13. xml-apis-1.0.b2.jar

PLEASE advise if i should exclude some jars from them.

like image 813
fresh_dev Avatar asked Jan 22 '26 23:01

fresh_dev


1 Answers

It is possible that some of the transitive dependencies may be unused, but there is no automated way to determine this. You can exclude all transitive dependencies to start with (using excludes tag), build/run the app and keep adding appropriate dependencies, when you get an error. Some of them would fail compilation, others fail app at runtime.

like image 156
Raghuram Avatar answered Jan 25 '26 12:01

Raghuram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!