[英]How can I Optimize Spring Framework usage for Google App Engine Applications
Google App Engine
frontend instances are dynamically scaled. Google App Engine
前端实例是动态扩展的。 That means App Engine
automatically creates new instances when load increases and turns off instances when they are not being used. 这意味着
App Engine
会在负载增加时自动创建新实例,并在不使用实例时关闭实例。 Reloading instances may result in additional latency for users. 重新加载实例可能会导致用户的额外延迟。 Frontend instances also have a
60 seconds
deadline to complete a given request. 前端实例也有
60 seconds
截止日期来完成给定的请求。
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 . 当我在GAE应用程序中使用
Spring MVC and Spring IOC
时,为了优化Spring Framework的使用,我已经完成了App Engine应用程序的最佳实践 。
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
. 它说,
automatic wiring
可以解决在应用程序初始化时间豆显著所需的时间,所以他们建议自动装配byName
而不是使用自动装配byType
。
So my question is How autowire byName
reduces bean resolving time ?? 所以我的问题是autowire
byName
如何减少bean的解析时间? . 。 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. 是否有任何
Spring IOC
最佳实践可以减少应用程序初始化时间。
Autowire "byType" obviously have to use some mechanism (and some processing )to correctly identify the bean whereas using "byName" provide a direct identification. Autowire“byType”显然必须使用某种机制(和一些处理)来正确识别bean,而使用“byName”提供直接识别。
Take an analogy of a group of many breed of cats and dogs. 比喻一组多种猫和狗。 To find the terrier out of the group you will have to first identify all breeds however when you use name of dogs it is much easier and improve the identification.
要找到群体中的小猎犬,您必须首先识别所有品种,但是当您使用狗的名称时,它更容易并且改进识别。
Spring does scanning of the classes for annotations which are inside package defined in "context:component-scan" if there are many classes in package it will take a while during start-up of an application hence it is suggested to use autowire byName. Spring会扫描类中的注释,这些注释位于“context:component-scan”中定义的包内,如果包中有许多类,则在启动应用程序时需要一段时间,因此建议使用autowire byName。
Let me give a reply to all the answers 让我回答所有答案
So my question is How autowire byName reduces bean resolving time ??
所以我的问题是autowire byName如何减少bean的解析时间?
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 已经由apurvc解释过,特别是如果你使用接口或者你使用大量的类继承Spring必须检查类的层次结构
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.
是否有任何Spring IOC的最佳实践可以减少应用程序初始化时间。
But you do not really need these solutions if you are JEE developer. 但如果您是JEE开发人员,那么您真的不需要这些解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.