Wednesday, April 25, 2007

Custom Namespaces in Spring 2.0

Authoring Custom Namespaces in Spring 2.0


Starting from version 2.0, Spring supports XML Namespaces. The purpose of this article is to discuss the new XML schema based configuration available in Spring 2.0. Familiarity with previous versions of Spring and basic AOP terms is assumed. Spring now supports and recommends usage of XML Schema rather than DTD. As users of previous versions, you might remember using the <bean> tag and its structure being declared in a DTD. Instead, this is now declared in a XML schema (spring-beans-2.0.xsd). Rest assured, the DTD configuration is 100% legal and is fully supported in Spring 2.0. DTD has its limitations and modern IDEs encourage using XML schema to fully utilize features like auto-complete that comes handy during XML authoring.
In the old-fashioned bean style configuration the developer has to know the name of the appropriate factory or proxy beans. Everything is a bean with a proxy or factory class and a different set of attributes.