【Spring学习笔记-5】Spring中的抽象bean以及bean继承
.wiz-todo, .wiz-todo-img {width: 16px; height: 16px; cursor: default; padding: 0 10px 0 2px; vertical-align: -7%;-webkit-user-select: none;} .wiz-todo-label { line-height: 2.5;} .wiz-todo-label-checked { color: #666;} .wiz-todo-label-unchecked {text-decoration: initial;} .wiz-todo-completed-info {padding-left: 44px; display: inline-block; } .wiz-todo-avatar { width:20px; height: 20px; vertical-align: -20%; margin-right:10px; border-radius: 2px;} .wiz-todo-account, .wiz-todo-dt { color: #666; }
<?xml version="1.0" encoding="GBK"?><beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.0.xsd"><!-- 定义Axe实例 --><bean id="steelAxe" class="org.crazyit.app.service.impl.SteelAxe"/><!-- 指定abstract="true"定义抽象Bean --><bean id="personTemplate" abstract="true"><property name="name" value="crazyit"/><property name="axe" ref="steelAxe"/></bean><!-- 通过指定parent属性指定下面Bean配置可从父Bean继承得到配置信息 --><bean id="chinese" class="org.crazyit.app.service.impl.Chinese"parent="personTemplate"/><bean id="american" class="org.crazyit.app.service.impl.American"parent="personTemplate"/></beans>
<?xml version="1.0" encoding="GBK"?><beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.0.xsd"><!-- 定义Axe实例 --><bean id="steelAxe" class="org.crazyit.app.service.impl.SteelAxe"/>- <!-- 通过指定parent属性指定下面Bean配置可从父Bean继承得到配置信息 -->
<bean id="chinese" class="org.crazyit.app.service.impl.Chinese"><property name="name" value="crazyit"/><property name="axe" ref="steelAxe"/><bean/><bean id="american" class="org.crazyit.app.service.impl.American"><property name="name" value="crazyit"/><property name="axe" ref="steelAxe"/><bean/></beans>
【Spring学习笔记-5】Spring中的抽象bean以及bean继承的更多相关文章
- spring学习笔记(一) Spring概述
博主Spring学习笔记整理大部分内容来自Spring实战(第四版)这本书. 强烈建议新手购入或者需要电子书的留言. 在学习Spring之前,我们要了解这么几个问题:什么是Spring?Spring ...
- Java架构师之路 Spring学习笔记(一) Spring介绍
前言 这是一篇原创的Spring学习笔记.主要记录我学习Spring4.0的过程.本人有四年的Java Web开发经验,最近在面试中遇到面试官总会问一些简单但我不会的Java问题,让我觉得有必要重新审 ...
- 1.2(Spring学习笔记)Spring中的Bean
一.<Bean>的属性及子元素 在1.1中我们对<Bean>有了初步的认识,了解了一些基本用法. 现在我们进一步理解<Bean>属性及子元素. 我们先来看下< ...
- Spring学习笔记之五----Spring MVC
Spring MVC通常的执行流程是:当一个Web请求被发送给Spring MVC Application,Dispatcher Servlet接收到这个请求,通过HandlerMapping找到Co ...
- Spring学习笔记之 Spring IOC容器(一)之 实例化容器,创建JavaBean对象,控制Bean实例化,setter方式注入,依赖属性的注入,自动装配功能实现自动属性注入
本节主要内容: 1.实例化Spring容器示例 2.利用Spring容器创建JavaBean对象 3.如何控制Bean实例化 4.利用Spring实现bean属性sett ...
- [Spring学习笔记 5 ] Spring AOP 详解1
知识点回顾:一.IOC容器---DI依赖注入:setter注入(属性注入)/构造子注入/字段注入(注解 )/接口注入 out Spring IOC容器的使用: A.完全使用XML文件来配置容器所要管理 ...
- [Spring学习笔记 3 ] spring 注解详解,完全注解,常用注解
.xml使用注解 xml 用来定义bean的信息,注解用来配置依赖信息 ) 在配置文件中配置bean )在javaBean中用注解来指定依赖注入 )在配置文件中开启注解扫描 @Resource标签 j ...
- [Spring学习笔记 1 ] Spring 简介,初步知识--Ioc容器详解 基本原理。
一.Spring Ioc容器详解(1) 20131105 1.一切都是Bean Bean可是一个字符串或者是数字,一般是一些业务组件. 粒度一般比较粗. 2.Bean的名称 xml配置文件中,id属性 ...
- Spring 学习笔记(2) Spring Bean
一.IoC 容器 IoC 容器是 Spring 的核心,Spring 通过 IoC 容器来管理对象的实例化和初始化(这些对象就是 Spring Bean),以及对象从创建到销毁的整个生命周期.也就是管 ...
- Spring学习笔记(一) Spring基础IOC、AOP
1. 注入类型 a) Spring_0300_IOC_Injection_Type b) setter(重要) c) 构造方法(可以忘记) d) ...
随机推荐
- gitlba的搭建与使用
实验环境继续使用git的实验环境,详情请点击连接https://www.cnblogs.com/cash-su/p/10131632.html 首先给服务器做一个本机的映射 [root@git1 ~] ...
- oracle查询在当前数据库下当前用户拥有的表语句
1.查询表的数目: select count(*) from tabs select count(*) from user_tables 2.查询用户拥有哪些表: select * from tabs ...
- 《Python》 代码块、小数据池和编码转换
一.代码块 Python程序是由代码块构造的.块是一个python程序的文本,他是作为一个单元执行的. 什么是代码块:一个py文件,一个函数,一个文件,一个类都是一个代码块. 作为交互方式输入的每一行 ...
- tensorflow 模型保存后的加载路径问题
import tensorflow as tf #保存模型 saver = tf.train.Saver() saver.save(sess, "e://code//python//test ...
- fopen & fcolse & fseek & ftell & fstat 文件操作函数测试
1.文件大小查询file_size.c 方法一:fseek + ftell: 方法二:ftell #include <stdio.h> #include <fcntl.h> # ...
- NBUT 1224 Happiness Hotel 2010辽宁省赛
Time limit 1000 ms Memory limit 131072 kB The life of Little A is good, and, he managed to get enoug ...
- HDU 2181 哈密顿绕行世界问题(DFS)
Problem Description 一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市. Input 前20行的第i行有3个数, ...
- HDU 4864
http://acm.hdu.edu.cn/showproblem.php?pid=4864 #include <iostream> #include <cstdio> #in ...
- 51Nod:1268 和为K的组合
1268 和为K的组合 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注 给出N个正整数组成的数组A,求能否从中选出若干个,使他们的和为K.如果可以 ...
- .NET 之 垃圾回收机制GC
一.GC的必要性 1.应用程序对资源操作,通常简单分为以下几个步骤:为对应的资源分配内存 → 初始化内存 → 使用资源 → 清理资源 → 释放内存. 2.应用程序对资源(内存使用)管理的方式,常见的一 ...