[hivemind] hivemind中的set-object 和set-service在性能上是否有区别(zhaow8810)
tapestry
2007-01-16
zhaow8810 问道
hivemind中 有set-object 和 set-service 我们自己开发业务层时 编写hivemodel.xml配制每个service间的关系 很容易用到注入。 但我不知道以上两种注入中 性能上是否有区别。object是在某一时刻构建的 估计注入时只是将引用注入进去,而service则是当时构建一个service代理 用到时再创建 应该有性能区别。有明白的吗 转自留言,希望大家在论坛里提问,谢谢。 |
|
tapestry
2007-01-16
set-object如果是<set-object property="context" value="service:tapestry.globals.WebContext" />这样的以service为前缀,则功能同set-service,set-object主要是提供更多的注入对象的方式,你可以实现org.apache.hivemind.service.ObjectProvider来定义你自己的前缀来注入对象。关于性能两者应该不存在区别,无非set-object多了个方法调用,
public class ServiceObjectProvider implements ObjectProvider { /** * Interprets the locator as a service id, and passes it to * {@link Module#getService(String, Class)}. */ public Object provideObject(Module contributingModule, Class propertyType, String locator, Location location) { if (HiveMind.isBlank(locator)) return null; return contributingModule.getService(locator, Object.class); } } |
相关讨论
相关资源推荐
- 报错:Could not find action or result解决办法
- Struts2严重: Could not find action or result [unknown location]
- Struth2过滤报错“警告: Could not find action or result”解决办法
- 警告: Could not find action or result 的原因
- Could not find action or result No result defined for action
- 报错:Could not find action or result
- Struts2的配置中:Could not find action or result 问题的解决方法
- WARN Dispatcher:68 - Could not find action or result
- 警告: Could not find action or result There is no Action mapped for namespace [/] and action name [] a
- Could not find action or result 解决办法