spring schema 扩展
spring 可以基于schema 扩展,自定义 schema。参考文档自己搭了个应用试验了一下:
?
首先看下自己写的 myns.xsd
?
?
?
然后看下我的applicationContxt.xml配置:
?
很明显实现了个自定义的bean ,这个bean有两个属性,一个是时间的格式,另外一个不知道啥东西。
?
然后在META-INF下面写了两个文件,
spring.handlers:用来描述如何处理自定义的namespace
?
package com.yajun.balance.spring;import java.text.SimpleDateFormat;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class MainTest { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); SimpleDateFormat f = (SimpleDateFormat) ctx.getBean("dateFormat"); System.out.println(f); }}?
===========================
?
xsd 基础 常用的简单 类型
?
- xs:string
- xs:decimal
- xs:integer
- xs:boolean
- xs:date
- xs:time
- xs:positiveInteger 1 楼 sunny3super 2012-07-16 好文章,另外 http://www.3822.net/topicshow/5802 这里也提供了一个类似的例子,并且提供源代码下载。