Spring DI via Java configuration. No XML!

In picocontainer you have only one option: configure your beans with pure Java code. Thats what I want. Because it is type safe and all major IDE will easily refactor this code later if necessary.

Then, with nanocontainer, it is even possible to write the configuration code in scripting languages.

In Spring you normally hook up your dependencies in an xml file. This is okay as long as you learn this ‘xml’. So, I looked around if there are alternatives to xml.

Here are the results:

2 thoughts on “Spring DI via Java configuration. No XML!

  1. Hi Peter, if you have any questions regarding JavaConfig, don’t hesitate to post on the forums. Also, you may want to give a try with the latest snapshots for the most up-to-date features and bugfixes.

    There is currently some support for JavaConfig in Spring IDE (assuming you use Eclipse), and IDEA has support as well. When M4 is released, we’ll see a much deeper tooling integration.

    Good things to come! Any feedback you may have will be appreciated, thanks.

    http://forums.springframework.com (Post JavaConfig questions in the Core Container forum for now)
    http://jira.springframework.com/browse/SJC (to browse the latest features & submit any bug reports)
    http://forum.springframework.org/showthread.php?t=55733&highlight=javaconfig&page=2 (for info on upgrading to M4 snapshots – will be documented properly soon enough)

    – Chris

    Chris Beams
    Sr. Consultant
    Lead, Spring Java Configuration
    SpringSource – http://springsource.com

Comments are closed.