4.4. Benefits and Drawbacks of Spring as Shared Library
Installing the Spring libraries as shared libraries is an option you must consider when multiple applications that use the same version of Spring are to be deployed on the same application server instance. However, this method has its advantages as well as disadvantages.
Advantages
- Reduces the size of the packaged applications(EARs, WARs, RARs)
- Reduces the number of times classloaders load Spring classes
- Provides a simple path to upgrade to a different version of Spring (a single place to do the replacement)
Disadvantages
- Flexibility considerations:The Spring module gets integrated with JBoss Enterprise Application Platform module system, and the dependencies of Spring modules are required to be reflected in the dependency system of the applications using it. As a result, the application becomes less isolated from rest of the application server. This is not necessarily a disadvantage but an item to consider when sharing Spring.
- Build Requirements:All applications deployed on the server must be built in a way that does not package Spring.
- Operational Issues:Installing the shared Spring libraries becomes part of the application server setup. The packaged applications do not contain the Spring libraries, and do not run on a server that does not contain the shared Spring libraries.