java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台(即JavaEE, JavaME, JavaSE)的总称。本站提供基于Java框架struts,spring,hibernate等的桌面应用、web交互及移动终端的开发技巧与资料

保持永久学习的心态,将成就一个优秀的你,来 继续搞起java知识。

1). 若字面值中包括特殊字符,则能够使用
value 节点的

<> zhou]]>

2). 在 Bean 的配置文件里, 能够通过 元素或 ref 属性为
Bean 的属性或构造器參数指定对 Bean 的引用.

ref="dao">
------------------------------------------------------------------------------
解析: 的作用为:
Dao dao = (Dao)ctx.getBean("dao");
Service service = (Service)ctx.getBean("service2");
service.setDao(dao);
3). 能够在属性或构造器里包括 Bean 的声明, 这种 Bean 称为内部 Bean

解释:类似于下面代码,但 dao 的这个 bean 事实上是没有 id 的,也不能被其它的 bean 来引用。也不能单独从 IOC 容器中获取。


①. 当 Bean 实例只给一个特定的属性使用时, 能够将其声明为内部 Bean.
内部 Bean 声明直接包括在 或 元素里, 不须要设置不论什么 id 或 name 属性
②. 内部 Bean 不能使用在不论什么其它地方
4). 能够使用专用的 元素标签为 Bean 的字符串或其他对象类型的属性注入
null 值


5). Spring 支持级联属性的配置。

6). 配置 java.util.List 类型的属性, 须要指定 标签, 在标签里包括一些元素.
这些标签能够通过 指定简单的常量值, 通过 指定对其它 Bean 的引用.
通过 指定内置 Bean 定义.
通过 指定空元素. 甚至能够内嵌其它集合.




7). 能够使用 util schema 里的集合标签定义独立的集合 Bean. 须要注意的是, 必须在 根元素里加入 util schema 定义
①. 导入 util 命名空间
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
②. 定义集合 Bean








8). 配置 Map Bean






9). 配置 Properties 的属性 update B C D 10). 使用 p 命名空间简化 bean 的属性配置:
①. 导入 p 的命名空间
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
②. 使用 p 命名空间进行配置
p:brand="Mazda"
p:corp="ChangAn"
p:maxSpeed="220"
p:price="200000"/>

因为水平有限,难免有疏忽或者不准确的地方,希望大家能够直接指出来,我会及时改正。一切为了知识的分享。

后续会有更多的精彩的内容分享给大家。