Discussion:
Ongoing Groovy Fight (Nanocontainer 1.1 branch)
Michael Rimov
2007-09-22 23:23:28 UTC
Permalink
Hi All,

I've had an ongoing fight with the Goovy Container Builder:

Let's say I have the following config script:

nano = builder.container(parent: parent) {
component(com.foo.Bar)
}

But due to a goof, com.foo.Bar doesn't exist in the classpath.

Unfortunately, groovy throws an extremely unhelpful exception:

groovy.lang.MissingPropertyException: No such property: com for class:
nanocontainer.

If I quote all the classes:

nano = builder.container(parent: parent) {
component('com.foo.Bar')
}

Then it delegates the class instantiation to the groovy container builder which
will correctly discern the problem. And while it is a workaround, the problem
is that it prevents me from being able to create containers with keys as classes
instead of class names.

I tried component(com.foo.Bar.class) to see if I could force groovy to recognize
that it was a class instead of a bean but to no avail.

Has anyone successfully forced groovy to recognize the classes without resorting
to quotes?

Anybody else versed enough in groovy to suggest a workaround that can be checked
into the groovy container builder?

Thanks!
-Mike




---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Loading...