java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台(即JavaEE, JavaME, JavaSE)的总称。本站提供基于Java框架struts,spring,hibernate等的桌面应用、web交互及移动终端的开发技巧与资料
保持永久学习的心态,将成就一个优秀的你,来 继续搞起java知识。
1). 若字面值中包括特殊字符,则能够使用
value 节点的
2). 在 Bean 的配置文件里, 能够通过 元素或 ref 属性为
Bean 的属性或构造器參数指定对 Bean 的引用.
------------------------------------------------------------------------------
解析:
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 声明直接包括在
②. 内部 Bean 不能使用在不论什么其它地方
4). 能够使用专用的
null 值
5). Spring 支持级联属性的配置。
6). 配置 java.util.List 类型的属性, 须要指定 标签,
在标签里包括一些元素.
这些标签能够通过
通过
通过
①. 导入 util 命名空间
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 的属性
①. 导入 p 的命名空间
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:corp="ChangAn"
p:maxSpeed="220"
p:price="200000"/>
因为水平有限,难免有疏忽或者不准确的地方,希望大家能够直接指出来,我会及时改正。一切为了知识的分享。
后续会有更多的精彩的内容分享给大家。
支付宝扫一扫
微信扫一扫
