Luckily / unluckily (depends on your view on the result J) I was in good mood yesterday evening and decided to invest some more in your project J
When implementing the gwt example I found manually wiring all components in context file really tedious. So… I decided to invest my time in automation of this work. I added basic support for autowiring to spring-me J
I did it by implementing another Augumentation (so you can easily remove it). So there are two augumentations now – fist qdox then autowiring. If you want to remove the autowiring – just remove the second one J
There is basic support for autowiring by name, by type and by constructor. Of course implementation is not completed - I am still working on it J
For example autowiring by type just checks if types are exactly the same, not “isAssignableFrom”, factory methods are not yet supported, etc.
Unit testing is far from complete, so you might expect bugs and inconsistencies.
But I guess you might be happy that at least someone is contributing J
Cheers,
woj
From: Wojciech Mlynarczyk
Sent: Thursday, March 05, 2009 9:57 AM
To: 'Wilfred Springer'
Cc: spri...@googlegroups.com
Subject: RE: JInjector discussion and plans
It seems… now when constructor parameters are always treated as strings. It looks like type parameter is missing…
I tried fixing it (maybe I did wrong) by modifying SpringConfigurationLoader and inserted
argument.setType(holder.getType());
in method:
private static void load(MutableInstance instance, BeanDefinition definition) {
instance.setReferencedType(definition.getBeanClassName());
instance.setPrimitive(false);
instance.setLazyInit(definition.isLazyInit());
instance.setId("source" + counter++);
instance.setFactoryMethod(definition.getFactoryMethodName());
instance.setFactoryInstance(definition.getFactoryBeanName());
if (definition instanceof AbstractBeanDefinition) {
instance.setInitMethod(((AbstractBeanDefinition) definition).getInitMethodName());
instance.setDestroyMethod(((AbstractBeanDefinition) definition).getDestroyMethodName());
}
if (!definition.getConstructorArgumentValues().isEmpty()) {
List<MutableConstructorArgument> arguments = new ArrayList<MutableConstructorArgument>();
for (Object object : definition.getConstructorArgumentValues()
.getGenericArgumentValues()) {
MutableConstructorArgument argument = new MutableConstructorArgument(instance);
argument.setInstance(instance);
ValueHolder holder = (ValueHolder) object;
argument.setSource(loadSource(argument, holder.getValue()));
argument.setType(holder.getType());
arguments.add(argument);
}
instance.setConstructorArguments(arguments);
}
Woj
...and I think I fixed it. Created a new issue for another problem though. (Your message is ending with a double quote. This turns out to be a problem when generating source code. (Obviously.) So I dropped the quote for now, and created a new issue to look at escaping characters.
On Mar 5, 2009, at 6:08 AM, Wilfred Springer wrote:
Hi Wojciech,
Despite the fixes you did, it's still not working for me, but that has to do with a bug in Spring ME. I know what is causing it, and in fact I knew it was something that I had to fix already for ages, but your code basically exposed me. ;-)
Anyhow, this is just to tell you that I'm working on it. I created an issue detailing the problem here:
On Mar 3, 2009, at 8:23 PM, Wojciech Mlynarczyk wrote:
Ok, I put together a simple dummy GWT application where all the dependencies are managed by spring-me context file. It is submitted under spring-me-gwt-sample directory, you can take a look J
From: Wilfred Springer [mailto:wil...@flotsam.nl]
Sent: Tuesday, March 03, 2009 8:55 AM
To: Wojciech Mlynarczyk
Subject: Re: JInjector discussion and plans Awesome. I still get an error while I build it (see below), but I'm sure it's something in the template.
Regarding the holder. It probably makes sense. Wicket has something similar, but calls it Model. IBM smalltalk had accessors (I don't remember if that was a general Smalltalk feature).
On Mar 3, 2009, at 1:15 AM, Wojciech Mlynarczyk wrote:
I submitted first version of the demo application. Of course it is not finished yet J For the moment it does nothing, just demonstrates how to use Spring Me in GWT.
Actually… I wanted to write a simple MVC-like application that uses Spring ME to wire the stuff… Using your concept of “Holder” objects that would actually be observables sending “updated” events whenever the object they hold is replaced by something else… Maybe it could be useful in real life… This thing is something I need in my project… What do you think?
From: Wilfred Springer [mailto:wil...@flotsam.nl]
Sent: Monday, March 02, 2009 2:23 PM
To: Wojciech Mlynarczyk
Subject: Re: JInjector discussion and plans I will add you as a developer wmlynar. ;-)
On Mar 2, 2009, at 1:36 PM, Wojciech Mlynarczyk wrote: