spring xml中的propery 的name属性名自来源
今天在运用spring的PropertyPlaceholderConfigurer时发现一个有意思的内容,当你在applicationContext中配置一个PropertyPlaceholderConfigurer的bean时,有location和locations的属性,不明思意location对应一个.properties文件,
locations对应多个.properties文件,冲着想看一下PropertyPlaceholderConfigurer的实现机制,于是查看了spring的源码,发现在PropertyPlaceholderConfigurer中并没有location和locations的属性,于是一路向上在父类PropertiesLoaderSupport中找到了locations的属性,但是没有location属性,奇怪?但在PropertiesLoaderSupport中却有setLocation和setLocations两个方法:
/**
* Set a location of a properties file to be loaded.
* <p>Can point to a classic properties file or to an XML file
* that follows JDK 1.5's properties XML format.
*/
public void setLocation(Resource location) {
this.locations = new Resource[] {location};
}
/**
* Set locations of properties files to be loaded.
* <p>Can point to classic properties files or to XML files
* that follow JDK 1.5's properties XML format.
*/
public void setLocations(Resource[] locations) {
this.locations = locations;
}
这样看来applicationContext.xml中的bean的property的name属性的值,并不是和对应类类中的属性内容是一致的
相关文档:
一个XML文件通常包含文件头和文件体两大部分
1. 文件头
XML文件头由XML声明与DTD文件类型声明组成。其中DTD文件类型声明是可以缺少的,关于DTD声明将在后续的内容中介绍,而XML声明是必须要有的,以使文件符合XML的标准规格。
在前面的Flowers.xml文件中的第一行代码即为XML声明:
<?xml 版 ......
public int createXMLFile(String filename) {
int returnValue = 0;
Document document = DocumentHelper.createDocument(); //生成Document,用于管理XML文档
Element booksElement = document.addElement("books"); //添加 ......
最近在sina看nba的文字直播的时候,对网站右下角的那一个聊天窗口产生兴趣,就决定自己也做一个。
上网查查资料,这样的聊天室无非就是用户输入数据传到服务器保存,然后用户页面再实时地从数据库取出数据,显示在页面上,即可完成一次聊天操作。
首先我定义了一个xml文件,用于保存用户 ......
本文转自:http://www.10086web.com/html/wangluobiancheng/Xmlbiancheng/2009/0612/90.html
一个客户提供一个股价的信息,要求放在页面上,显示一些数据,需要从远程获取xml,然后解析写在网页上,开始不会觉得很难,其实蛮简单的,先用javascript写了一个:
<mce:script language=javascript><!--
......