samedi 14 mars 2015

Attribute 'local' is not allowed to appear in element 'ref' in Spring .1.5

I am almost new to Spring moving over from component-based framework to request ones.

Just to get the basic overview, I am currently going through Mkyong Spring 3.0 tutorial.


He goes on to clarify these 2 basic things.

1. Bean in different XML files



If you are referring to a bean in different XML file,
you can reference it with a ‘ref‘ tag, ‘bean‘ attribute.


2. Bean in same XML file



If you are referring to a bean in same XML file,
you can reference it with ‘ref‘ tag, ‘local‘ attribute.


The only thing I can make out is that the local attribute is not supported any more in version 4.1.5 . For the timebeing, I have sticked to the



<ref bean="thebeaninstance"/>


and it works for both. <ref bean="..."> requires only it to be in the same context , or in a parent context .


But i am looking for that particulr thing by which i will be able to resolve the difference once if somehow i encounter same ids in 2 different beans, and wish to refer to the one defined in different XML, since preference goes to the one defines in the same XML. How will then I?


Can someone gives a helping sign?


Aucun commentaire:

Enregistrer un commentaire