Spring.NET : Knight.NET example - No Fluff Just Stuff

Spring.NET : Knight.NET example

Posted by: Craig Walls on May 23, 2005

As I've mentioned in an earlier blog, I've been playing around with Spring.NET in my spare time. What has resulted from that is a .NET version of the Knight example from chapter 1 of Spring in Action. You can download the code (complete with an NAnt build) from here.

If you use NAnt to build it, the default target ("cs-build") will build the C# version. If you'd like to build the VB.NET version instead, use the "vb-build" target. Be aware, however, that I've had some trouble building the VB.NET version under Mono. I can manually compile it fine, but NAnt gives me all sorts of errors. Oddly, this only happens under Mono. When I build it on my wife's XP machine, it works fine.

This has been a bit of an adventure as I've got to learn C#, VB.NET, Spring.NET, Mono, and NAnt all at once. (My next trick is to figure out log4net so that I can use that instead of Console.WriteLine.)

Here's what I've learned about Spring.NET so far:

  • The current download (version 0.6) is only the IoC container and very little else.
  • AOP and web stuff will be in the next version (0.7), but you can get a sneak-peak by downloading the nightly builds. (The Knight example comes with Spring.Core.dll and Spring.Aop.dll from the May 15th nightly build.)
  • As I've stated before, at least with regard to IoC, the main difference between Spring (Java edition) and Spring.NET is that you change the word "Bean" to "Object".
  • The only other minor difference is that when you specify an object type in the XML, you must also specify the assembly that the class can be found in.
Craig Walls

About Craig Walls

Craig Walls is a Principal Engineer, Java Champion, Alexa Champion, and the author of Spring AI in Action, Spring in Action, and Build Talking Apps. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 1 bird and 2 dogs.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »