Custom Namespaces for Spring Configurations

Well, this feature is explained in the Spring docs (section B.6. Using a custom extension in your Spring XML configuration) and TheServerSide.com had thorough article on that matter:

Please note that these two files should be present in the META-INF directory of your JAR. In fact, if you open the spring.jar under the META-INF directory, you can see the details of all the schema and handlers for the namespaces that comes with Spring.

Authoring Custom Namespaces in Spring 2.0

Couple of extra hints: as your project in most cases should run fine from an IDE, you'll have to pre-bundle a jar with at least those two files (spring.handlers and spring.schemas) in META-INF (no other way to do that w/o packaging a custom jar on each run). And, notice that spring.schemas uses schema location as an url, not schema URI.

No comments: