java - Can I change the implementation class injected by spring in runtime? -
i have class has injected spring on applicationcontext.xml , need change implementation without change applicationcontext.xml.
i heard aop "introductioninterceptor" don't found many useful results.
anyone can me?
ps. sorry bad english, hope give understand.
you can in several ways, here few:
write xml file, override configuration adding same bean id , implementation class want use, import new xml existing application context.
through code, base on need can set new implementation before calling code.
there more have used '1' in number of projects.
if have multiple beans same id, spring pickup latest one, e.g.
<beans> <import resource="a.xml"/> <import resource="b.xml"/> </beans>
now if both a.xml
, b.xml
have bean defined same id, spring use bean defined in b.xml
.
cheers !!
Comments
Post a Comment