本文介绍了Spring中的@Configurable注释的XML等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有@Configurable注释的XML等价物?

Is there any XML equivalent of @Configurable annotation?

例如对于bean:

<bean class="org.obliquid.sherd.domain.SalesDocument" scope ="prototype">
    <property name="docType" ref="documentTypeProto"/>
</bean>

如何判断SalesDocument应该是@Configurable?

How can I tell that SalesDocument should be @Configurable?

推荐答案

否 - @Configurable 的目的是将属性注入非Spring bean的对象中。在您的示例中, SalesDocument 已经是一个Spring bean,并且将注入 docType

No - the purpose of @Configurable to inject properties into objects that are not Spring beans. In your example SalesDocument is already a Spring bean, and docType will be injected.

这篇关于Spring中的@Configurable注释的XML等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 22:32