Spring案例--打印机
2024-09-01 08:48:18
目录:
1.applicationContext.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--注入bean
id相当于当前bean唯一标识
class是bean 的全路径
property注入bean中的属性 必须封装
-->
<!--注入墨盒-->
<bean id="colorInk" class="cn.spring.print.ink.ColorInk"></bean>
<bean id="blackWhiteInk" class="cn.spring.print.ink.BlackWhiteInk"></bean>
<!--注入纸张-->
<bean id="a4Paper" class="cn.spring.print.paper.A4Paper"></bean>
<bean id="b5Paper" class="cn.spring.print.paper.B5Paper"></bean>
<!--打印机-->
<bean id="printer" class="cn.spring.print.printer.Printer">
<!--将墨盒纸张组合起来-->
<property name="paper" ref="b5Paper"></property>
<property name="ink" ref="colorInk"></property>
</bean>
</beans>
2.墨盒接口 Ink
3.黑白墨盒实现类 BlackWhiteInk
4.彩色墨盒实现类 ColorInk
5.纸张接口 Paper
6. A4纸张实现类 A4Paper
7. B5纸张实现类 B5Paper
8. 打印机类 Printer
9. 测试类 PrintTest
最新文章
- Chrome 开发工具之Sources
- ttf文件属性详细信息
- Excel表格导入数据
- nodeType的返回
- java12-6 冒泡排序法和选择排序法
- Linux:返回上一次目录 / 返回上次命令目录
- java_弹球小游戏
- Java公开课-01.类和对象
- 完美解决某法院HP EVA8400删除VDISK问题
- mybaties xml 的头部
- React修改state(非redux)中数组和对象里边的某一个属性的值
- (3)Python字符串
- Nginx教程---03.Nginx日志切割
- 软件包管理之rpm与yum
- jupyter快捷键
- shell特殊变量,记录一下
- Type Operators instanceof is used to determine whether a PHP variable is an instantiated object of a certain class/a class that implements an interface
- c#7的新特性
- Unity项目中的资源管理
- iOS:在tableView中通过Masonry使用autolayout在iOS7系统出现约束崩溃
热门文章
- LeetCode刷题191125
- 表单生成器(Form Builder)之伪造表单数据番外篇——随机车辆牌照
- MAC下安装pomelo
- web攻击与防御技术-平台搭建与暴力破解
- 如何使redis中存放的都是热点数据?
- PAT 1013 Battle Over Cities DFS深搜
- 使用vue-cli创建工程的时候提示vue-cli Failed to download repo vuejs-templates/webpack-simple:self signed certificate in certificate chain的解决方法
- 网站报";组策略阻止了这个程序。要获取详细信息,请与系统管理员联系。";错误。
- MySQL学习——管理事务
- 池化HttpClient,拿去就能用