Can the Spring Framework be used in android applications?

Spring has libraries for android but its for efficiently doing REST communication with some OAuth the detailed information is available here spring-android and the developers of spring advocate using RoboGuice for DI you can read about it from here, for hardcore dependency injection its RoboGuice which is by far the best out there.


If you need DI and Spring, please give RoboSpring a try. I have ported the Spring Framework to Android and tweaked the performance significantly! From the description:

RoboSpring is a (real) port of the Spring Framework to the Android platform. Additionally it offers preliminary support for functionality introduced by RoboGuice like injecting View references into Activities and more. RoboSpring is based on version 3.1.0 RELEASE of Spring's core, beans, context and aop components. It offers the following functionality:

  • Configure application components with a Spring configuration file (XML)
  • Autowire your Android components with beans from the Spring application context.
  • Inject the Android application context into your Spring Beans.
  • Inject views into Activities.
  • … and more

Please see here: https://github.com/dthommes/RoboSpring

RoboSpring - Inversion of Control for Android


Don't. Spring is a heavy weight server-side framework that is not optimized for Android. The have some Android libraries, but those are for specific things like REST. If you need DI, use an Android framework such as RoboGuice.


If you need the dependency injection only. You may choose some lightweight framework like google guice.