Spring wiring by type is slower by magnitude than wiring by name Spring wiring by type is slower by magnitude than wiring by name spring spring

Spring wiring by type is slower by magnitude than wiring by name


This problem is now solved in Spring with the resolution of SPR-6870. See the resolution comments there for details. The fix is available as of versions 3.2.0.RELEASE and 3.1.2.


Most Spring apps wire things together on startup, rather than grabbing beans from the context at runtime. Even still, unless you are changing your application context a lot during the regular running of your app, you should not ever fetch a bean more than once.

Given that, if your users are complaining of slowness, it seems your real problem is too many bean lookups; your use of a slower means of doing so has just surfaced the real problem.

I would try moving to Java Config (configure your dependencies in Java, supported in Spring 3.0 I believe) and configuring your app to wire all beans at startup. This also has the advantage that your app just won't start if dependencies can't be met.