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Ekgd291bGQgYWN0dWFsbHkgbGlrZSB0byBnZXQgdGhpcyBpbnRv IE0yLCBhbHRob3VnaCBpdCdzIHByZXR0eSBjbG9zZSBhbHJlYWR5LiBBcyB0aGUgY2hhbmdlIGlz IHRyaXZpYWwgdG8gaW1wbGVtZW50IGFuZCBmdWxseSBiYWNrd2FyZCBjb21wYXRpYmxlLCB0aGF0 IHNob3VsZG4ndCBtYXR0ZXIgdG9vIG11Y2guDQogDQpKdWVyZ2VuDQogDQpQLlMuOg0KVGhlIHNh bWUgaXNzdWUgZXhpc3RzIHdpdGggdGhlIHJhcmVseSB1c2VkICJwYXJlbnQiIGF0dHJpYnV0ZSBv ZiB0aGUgImJlYW4iIHRhZy4gQ3VycmVudGx5LCAicGFyZW50IiBjYW4gcmVmZXJlbmNlIGFueSBr aW5kIG9mIG5hbWU7IHdlIGNvdWxkIGludHJvZHVjZSB0aGUgYWJvdmUgcGF0dGVybiBhIGxhICJw YXJlbnQiIGFuZCAicGFyZW50LWlkIiBmb3IgdGhlIHNha2Ugb2YgY29uc2lzdGVuY3kuDQogDQo= |
|
From: Colin S. <col...@ex...> - 2003-10-19 15:05:53
|
jürgen höller [werk3AT] wrote: >Everybody, > >On the occasion of allowing a single application context to be loaded from multiple XML files, I've reconsidered a detail of our XML syntax: The "ref" tag currently has two different attributes: >- "bean" to reference a bean in the same application context via its id attribute (the XML id); >- "external" to reference a bean in a parent context. >The latter can basically address any bean, be it in the same context or a parent, an id or an alias name. > >The main rationale behind the "bean"/"external" separation was simply separating between XML validation of id refs (by the XML parser) and referencing any kind of name (validated by the bean factory). The latter was mainly necessary for referencing beans outside of the current XML file, at that time a parent context. In the mean time, a single context can be defined by multiple XML files; thus I don't consider the "bean"/"external" naming appropriate anymore. > >Instead, let me suggest different attribute names: >- keep a "bean" attribute to reference *any* kind of name, be it id or alias, just like the current "external" attribute; >- introduce a new "bean-id" attribute to reference a bean in the same XML file via its XML id, like the current "bean" attribute. > >If we keep the "external" attribute for the moment as an equivalent of the proposed "bean" attribute, this would be fully compatible with existing bean definition files. Of course, "bean" attributes would not get validated by the XML parser anymore, but that would not break the files in any way. "external" attributes would still work too, the same as before. > >We should recommend migrating to the new pattern though, i.e.: >- rename "bean" to "bean-id"; >- rename "external" to "bean". >That should be easy to do; and as the old pattern still works, there is no need to migrate existing bean definition files immediately. > >I've thought about this for a while, and I consider it very important to clarify the attributes in a way like the above. Else, it will be pretty hard to explain the rationale behind "bean" and "external", especially when using multiple XML files for a single context. "bean" and "bean-id" are far easier to explain: "bean" always works, "bean-id" adds validation by the XML parser if specifying a bean id in the same context. > >Any thoughts on this, any strong objections? I would actually like to get this into M2, although it's pretty close already. As the change is trivial to implement and fully backward compatible, that shouldn't matter too much. > > Even the current 'external' can be considered to still make sense if you ust consider it to mean the bean you are refering to is 'external' to the current xml file, as opposed to the current definition, that is it external to the current context. However, I do agree that it's probably cleaner and makes more sense to just go with 'bean' and 'bean-id', and emphasize that the latter should be used if possible for extra validation... That point should definitely be documented properly (and used in the examples), so people don't accidentally throw away this free validation by using just 'bean'. |
|
From: Trevor C. <pr...@se...> - 2003-10-19 19:26:18
|
+1
Trevor
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of j=C3=BCrgen h=C3=B6ller [werk3AT]
Sent: October 18, 2003 5:42 PM
To: spr...@li...
Subject: [Springframework-developer] XML bean references
Everybody,
=20
On the occasion of allowing a single application context to be loaded =
from multiple XML files, I've reconsidered a detail of our XML syntax: =
The "ref" tag currently has two different attributes:
- "bean" to reference a bean in the same application context via its id =
attribute (the XML id);
- "external" to reference a bean in a parent context.
The latter can basically address any bean, be it in the same context or =
a parent, an id or an alias name.
=20
The main rationale behind the "bean"/"external" separation was simply =
separating between XML validation of id refs (by the XML parser) and =
referencing any kind of name (validated by the bean factory). The latter =
was mainly necessary for referencing beans outside of the current XML =
file, at that time a parent context. In the mean time, a single context =
can be defined by multiple XML files; thus I don't consider the =
"bean"/"external" naming appropriate anymore.
=20
Instead, let me suggest different attribute names:
- keep a "bean" attribute to reference *any* kind of name, be it id or =
alias, just like the current "external" attribute;
- introduce a new "bean-id" attribute to reference a bean in the same =
XML file via its XML id, like the current "bean" attribute.
=20
If we keep the "external" attribute for the moment as an equivalent of =
the proposed "bean" attribute, this would be fully compatible with =
existing bean definition files. Of course, "bean" attributes would not =
get validated by the XML parser anymore, but that would not break the =
files in any way. "external" attributes would still work too, the same =
as before.
=20
We should recommend migrating to the new pattern though, i.e.:
- rename "bean" to "bean-id";
- rename "external" to "bean".
That should be easy to do; and as the old pattern still works, there is =
no need to migrate existing bean definition files immediately.
=20
I've thought about this for a while, and I consider it very important to =
clarify the attributes in a way like the above. Else, it will be pretty =
hard to explain the rationale behind "bean" and "external", especially =
when using multiple XML files for a single context. "bean" and "bean-id" =
are far easier to explain: "bean" always works, "bean-id" adds =
validation by the XML parser if specifying a bean id in the same =
context.
=20
Any thoughts on this, any strong objections? I would actually like to =
get this into M2, although it's pretty close already. As the change is =
trivial to implement and fully backward compatible, that shouldn't =
matter too much.
=20
Juergen
=20
P.S.:
The same issue exists with the rarely used "parent" attribute of the =
"bean" tag. Currently, "parent" can reference any kind of name; we could =
introduce the above pattern a la "parent" and "parent-id" for the sake =
of consistency.
=20
+=12=17 ?[){([ ' +=1E.) Z+??`zw=1E Li8^=12Z+.) =
6??ig [ +kj?"8^=12{^? b^=06?v(=17?9 q {ay' ? 0 +=1E) +o o =
*kx=1F ?zZ)zXX*kx=1F? ?zZ)z l .a=1Ew i +-(=1E~ { b ?+-w k?x=1F? =
?zZ)
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 09/10/2003
|