View RSS Feed

Spring Framework

Writing A Namespace Handler in Spring

Rate this Entry
by , 11-27-2011 at 09:58 PM (1424 Views)
Custom XML namespaces were introduced in Spring 2.0. Similar to Java packages, custom namespaces make it possible to define components without concern of colliding with other named components. Spring has already some predefined namespaces such as jee, aop, util, as well as others. Custom namespaces are handled using the NamespaceHandlerSupport class that generates metadata to be consumed by the Spring framework. This metadata is processed by parser classes that are also supplied by a component developer. In order to properly enable a custom namespace and components you need to do the following:

  1. Create an XSD file that defines a component
  2. Create a component in java with the component logic
  3. Create a namespace handler mapping to the schema to the beans
  4. Create a bean definition parser to handle parsing the bean configuration data
  5. Create the deployment and descriptor files
  6. Package it up in a .jar file

Submit "Writing A Namespace Handler in Spring" to Facebook Submit "Writing A Namespace Handler in Spring" to Digg Submit "Writing A Namespace Handler in Spring" to del.icio.us Submit "Writing A Namespace Handler in Spring" to StumbleUpon Submit "Writing A Namespace Handler in Spring" to Google

Comments