[英]Use Spring as object factory for Morphia
I need to inject some fields to objects loaded from Mongo via Morphia using @Autowired
annotations. 我需要使用
@Autowired
批注向通过Morphia从Mongo加载的对象注入一些字段。 I found an example how that's made with Guice: 我找到了一个示例,它是如何用Guice制作的:
Injector injector = Guice.createInjector(...);
MapperOptions options = injector.getInstance(Morphia.class)
.getMapper()
.getOptions();
options.setObjectFactory(new GuiceObjectFactory(
options.getObjectFactory(),
injector
));
So they use GuiceObjectFactory
. 因此,他们使用
GuiceObjectFactory
。 Is there anything alike in Spring? 春天有什么相似之处吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.