How can I Optimize Spring Framework usage for Google App Engine Applications

google-app-engine, java, spring, spring-mvc

Solution

Let me give a reply to all the answers

So my question is How autowire byName reduces bean resolving time ??

already explained by apurvc, in particular if you use interface or you use massive class inheritance Spring will have to inspect the hierarchy of classes

I would like to know is there any better way to inject beans ?

- Yes, do not inject bean by autowire but use set or get property, as you can; I use this policy.

- Avoid autoscan component

- Use singleton or bean pools or factory to reuse or construct object

Is there any best practices for Spring IOC to reduce application initialization time.

- use lazy initialization (@Lazy annotation)

- put not dependent bean at the top of XML definition

But you do not really need these solutions if you are JEE developer.

Problem

`Google App Engine` frontend instances are dynamically scaled. That means `App Engine` automatically creates new instances when load increases and turns off instances when they are not being used. Reloading instances may result in additional latency for users. Frontend instances also have a `60 seconds` deadline to complete a given request. As I am using `Spring MVC and Spring IOC` in my GAE application, to Optimize Spring Framework usage, I have gone through Best Practices for App Engine Applications. In that link I am completely confused with the section Reducing or Avoiding the Use of Relationship Autowiring . It says `automatic wiring` can significantly the time required to resolve the beans during application initialization time, so they suggest autowire `byName` instead of using autowire `byType` . So my question is How autowire `byName` reduces bean resolving time ?? . And also I would like to know is there any better way to inject beans ?. Is there any best practices for `Spring IOC` to reduce application initialization time.

Original source