As mentioned in an earlier entry, I've been monkeying around with Mono on my MacOS X machine with the intent of experimenting with Spring.NET, the .NET port of Spring. After struggling a bit with Spring.NET's configuration XML, I finally managed to get a rough approximation of the Knight example from chapter 1 of Spring in Action to work under Spring.NET. Here's what I've learned thus far:
Anywhere I'd use "bean" in the Java edition of Spring, I now use "object" in Spring.NET. This applies to both the XML file...
<objects xmlns="http://www.springframework.net">
<object name="lancelot" type="Habuma.Knight, Knight">
<property name="quest">
<ref object="dragonQuest"/>
</property>
</object>
<object name="dragonQuest" type="Habuma.SlayDragonQuest, Knight"/>
</objects>...and when using the application context...
IKnight knight = (IKnight) ctx.GetObject("lancelot");
When specifying the object type, I must also specify which .NET assembly that the object class can be found in. For example, I'm compiling everything to Knight.exe, so my assembly name is "Knight". Thus to load an object of type "Habuma.Knight" from the "Knight" assembly, I set the type to "Habuma.Knight, Knight".
Correctly specify the XML namespace. This is what frustrated me for several days before I finally figured it out. Be sure to set xmlns to "http://www.springframework.net" or else you'll get NullReferenceExceptions when the application context is loading (apparently this is only a problem when running under Mono...I don't have the same problem running under .NET on Windows).
For your amusement, here's the code I've been playing with. I'm using NAnt to build it, so you'll need NAnt installed. If you'd rather build it through VisualStudio.NET, then I leave that as an exercise for the reader.