是否有@Configurable注释的XML等效版本?
例如,对于bean:
<bean class="org.obliquid.sherd.domain.SalesDocument" scope ="prototype">
<property name="docType" ref="documentTypeProto"/>
</bean>
如何确定SalesDocument应该是@Configurable?
是否有@Configurable注释的XML等效版本?
例如,对于bean:
<bean class="org.obliquid.sherd.domain.SalesDocument" scope ="prototype">
<property name="docType" ref="documentTypeProto"/>
</bean>
如何确定SalesDocument应该是@Configurable?
@Configurable
的目的是将属性注入到不是Spring bean的对象中。在你的例子中,SalesDocument
已经是一个Spring bean了,而docType
将被注入。据我所知,目前没有简单的方法来完成这个任务。
要实现你想要的效果,一种方法是考虑使用基于Spring AspectJ的AOP扩展。这可能需要很多工作,但如果你知道你的DAOs只需要有限的配置(可能只是EntityManager
?),那么这个任务可能是可行的。
详细信息请参考Spring参考文档。