欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Spring案例打印機的實現(xiàn)過程詳解

 更新時間:2019年10月24日 14:20:32   作者:關(guān)耳er  
這篇文章主要介紹了Spring案例打印機的實現(xiàn)過程詳解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

這篇文章主要介紹了Spring案例打印機的實現(xiàn)過程詳解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

目錄:

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相當(dāng)于當(dāng)前bean唯一標(biāo)識
    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.黑白墨盒實現(xiàn)類BlackWhiteInk

  

4.彩色墨盒實現(xiàn)類ColorInk

  

5.紙張接口Paper

  

6. A4紙張實現(xiàn)類 A4Paper

  

7. B5紙張實現(xiàn)類B5Paper

  

8. 打印機類 Printer

  

9. 測試類PrintTest

  

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論