The newly-added autowire-services is really a great boon; this will
greatly reduce configuration files and save lots of typing... but
maybe considering that _every_ interface may be a service is a bit too
eager. Just think about CharSequence, Serializable, Collection and
other commonly used core interfaces.
Possible immediate solution: BuilderFactory should automatically
disconsider interfaces in the java.* packages. It's very unlikely to
have a business service typed as one of the core packages. javax.*
should be still considered: javax.sql.DataSource is a perfect
candidate for a service, as many other interfaces in SPI packages.
I'm just worried about logging too many obviously harmless errors:
while informative at first, it gets annoying when you see hundreds of
messages telling you that hivemind couldn't find a service
implementing the java.lang.CharSequence interface. Duh.
Guess what goes attached?
-- Marcus Brito
Index: BuilderFactoryLogic.java
===================================================================
RCS file: /home/cvspublic/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java,v
retrieving revision 1.4
diff -w -u -r1.4 BuilderFactoryLogic.java
--- BuilderFactoryLogic.java 19 Jul 2004 14:07:36 -0000 1.4
+++ BuilderFactoryLogic.java 19 Jul 2004 16:31:52 -0000
@@ -289,11 +289,13 @@
if (!propertyType.isInterface())
return;
- // Here's the problem with autowiring; there can be other stuff besides
- // services that are writable; since lots of classes inherite from
- // BaseLocatable, Location is one of those property types.
+ // Interfaces in java.* packages are very unlikely to be services, so we ignore
+ // them here. If you really need a service that implements an interface in one
+ // of the core packages, you should explicitly set it instead of using autowire.
+ // The same argument applies to the org.apache.hivemind.Location interface: just
+ // too much stuff implements this interface.
- if (propertyType.equals(Location.class))
+ if (propertyType.getName().startsWith("java.") || propertyType.equals(Location.class))
return;
try
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]