|
From: <jue...@we...> - 2004-09-17 13:02:49
|
I personally prefer to specify multiple bean definitions files via a =
"contextConfigLocation" that contains multiple resource paths. This =
allows to drive combinations through that init-param, without having to =
touch the bean definition files themselves: for example, to easily =
switch between "dataAccessContext-hibernate.xml" and =
"dataAccessContext-jdbc.xml".
I guess it boils down to a matter of taste: Both ways have their =
individual merits. That's why I finally added the "import" tag (which is =
still not committed, BTW - will do so tonight).
If a single file gets loaded multiple times for a single context, later =
bean definitions will simply replace existing ones of the same name. =
There is no explicit check for duplicate files: This rather works at the =
individual bean definition level.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Keith
Sent: Thursday, September 16, 2004 4:34 PM
To: spr...@li...
Subject: RE: [Springframework-developer] Import tag for XML bean
definitions
This sounds great! Just curious, why wouldn't you recommend it too =
much? =20
I know I've had mention before people wanting to see logically how the =
files
are related - when they're looking at the files (rather than going to
bootstrap configuration, generally separate.) Kind of a "less magic" =
thing.
I think the import tag, like the recent abstract attribute for abstract =
bean
definitions, can help make things more explicit.
<beans description=3D"Business layer services definitions">
<import resource=3D"data-access.xml"
description=3D"Import dependent DAO definitions"/>
<bean> ... </bean>
...
</beans>
Just curious: if I was to do like above, and still bootstrap a single
application context with "business-layer.xml" and "data-access.xml" as
opposed to just "business-layer" - what happens?
Let's say I had a "utilities-context.xml" with utility beans used by my
other contexts (like PropertyPlaceholderConfigurer), used by business =
and
dao. If I imported that guy into those files, but in the end everything
resulted in a flat "big" context -- what would happen?
Getting code churned out at the airport is the best! :-) Keith=20
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...] On Behalf =
Of
j=FCrgen h=F6ller [werk3AT]
Sent: Thursday, September 16, 2004 4:22 AM
To: spr...@li...
Subject: [Springframework-developer] Import tag for XML bean definitions
Hi everybody,
During an extra evening I had to spend at an airport hotel in Rome, I've
implemented an "import" tag for XML bean definitions:
http://opensource.atlassian.com/projects/spring/browse/SPR-137
Basically, you can put any number of "import" tags at the beginning of =
bean
definition files:
<beans>
<import resource=3D"myImport1.xml"/>
<import resource=3D"myImport2.xml"/>
<bean ... />
</beans>
The resource locations are interpreted as relative to the file that =
contains
the import tags. Effectively, this is delegated to the "createRelative"
method on the Resource interface, invoked on the Resource object for the
containing file. ("createRelative" has already been introduced in 1.1
final.)
I'll commit this tonight, provided that there aren't any objections. =
While
I'm not gonna recommend this feature too much, as I personally prefer a
"contextConfigLocation" that refers to multiple files, I still believe =
that
an import tag is a useful addition. In particular, some people are used =
to
such a feature from Ant and XWork...
Juergen
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|