Can spring framework override Annotation-based configuration with XML-based configuration? -
can spring framework override annotation-based configuration xml-based configuration? need change dependency of bean defined via annotations , not author of bean.
this should ok. spring bean context allows redefine beans, "later" definitions overriding "earlier ones". should apply xml-defined beans annotation-defined beans, if they're mixed.
for example, if have
@configuration public class myannotatedconfig { @bean public object beana() { ... } }
<bean class="com.xyz.myannotatedconfig"/> <bean id="beana" class="com.xyz.beana"/>
in case, xml definition of beana
should take precedence.
Comments
Post a Comment