国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

佛山做網(wǎng)站3000自己網(wǎng)站怎么推廣

佛山做網(wǎng)站3000,自己網(wǎng)站怎么推廣,cms是什么意思體積,電子商務(wù)網(wǎng)站建設(shè)設(shè)計(jì)Spring 泛型依賴注入,是利用泛型的優(yōu)點(diǎn)對代碼時(shí)行精簡,將可重復(fù)使用的代碼全部放到一個(gè)類之中,方便以后的維護(hù)和修改,同時(shí)在不增加代碼的情況下增加代碼的復(fù)用性。 示例代碼: 創(chuàng)建實(shí)體類 Product package test.spri…

Spring 泛型依賴注入,是利用泛型的優(yōu)點(diǎn)對代碼時(shí)行精簡,將可重復(fù)使用的代碼全部放到一個(gè)類之中,方便以后的維護(hù)和修改,同時(shí)在不增加代碼的情況下增加代碼的復(fù)用性。

示例代碼:

  1. 創(chuàng)建實(shí)體類
    Product
    
    package test.spring.model;public class Product {private int id ;private String name;/* setter getter省略 */@Overridepublic String toString() {return "Product [id=" + id + ", name=" + name + "]";}}
    User
    package test.spring.model;public class User {private int id;private String name;/* setter、getter省略 */@Overridepublic String toString() {return "User [id=" + id + ", name=" + name + "]";}public User() {super();}}
  2. 創(chuàng)建Dao層相關(guān)接口及實(shí)現(xiàn)類

    對dao層的相同功能提取出來,創(chuàng)建一個(gè)帶泛型的BaseDao類用于共用。
    package test.spring.Dao;import org.springframework.stereotype.Repository;/*必須加入注解,將BaseDao注入Spring容器,因?yàn)锽aseService中有引用該類*/
    @Repository
    public class BaseDao<T> {public void add(T t) {System.out.println("BaseDao...."+t);}}

    UserDao接口
    package test.spring.Dao;import test.spring.model.User;public interface UserDao {public void add(User user);}
    

    UserDao實(shí)現(xiàn)類
    ?

    package test.spring.Dao;
    import org.springframework.stereotype.Repository;import test.spring.model.User;
    @Repository ("userDaoImpl")
    public class UserDaoImpl extends BaseDao<User> implements UserDao {}
    

    ProductDao接口
    ?

    package test.spring.Dao;import test.spring.model.Product;public interface ProductDao {public void add(Product pro);
    }

    ProductDao實(shí)現(xiàn)類
    ?

    package test.spring.Dao;import org.springframework.stereotype.Repository;import test.spring.model.Product;
    @Repository("productDao")
    public class ProductDaoImpl extends BaseDao<Product> implements ProductDao {}

  3. Spring配置
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"><context:component-scan base-package="test.spring" >	</context:component-scan></beans>
  4. 測試
    package testSpring;import org.junit.Test;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;import test.spring.model.Product;
    import test.spring.model.User;
    import test.spring.service.ProductService;
    import test.spring.service.UserService;public class TestSpring {@Testpublic void testUser() {ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");UserService userService=(UserService) ac.getBean("userService");userService.add(new User());System.out.println("-----------------------------");ProductService  proService= (ProductService) ac.getBean("prodcutService");proService.add(new Product());}
    }
    結(jié)果:

http://aloenet.com.cn/news/41419.html

相關(guān)文章:

  • wordpress添加郵件輸入列表廈門網(wǎng)站優(yōu)化公司
  • dede網(wǎng)站qq類源碼百度快照下載
  • 即時(shí)通訊網(wǎng)站開發(fā)源碼手機(jī)百度瀏覽器
  • 怎么做網(wǎng)絡(luò)銷售的網(wǎng)站國內(nèi)新聞
  • 靜態(tài)企業(yè)網(wǎng)站模板目前最靠譜的推廣平臺(tái)
  • 西安最好的網(wǎng)站建設(shè)公司品牌推廣思路
  • 做簡圖的網(wǎng)站網(wǎng)絡(luò)營銷專業(yè)代碼
  • 一個(gè)公司設(shè)計(jì)網(wǎng)站怎么做近三天發(fā)生的大事
  • 網(wǎng)站建設(shè)最新教程網(wǎng)絡(luò)營銷外包收費(fèi)
  • 網(wǎng)站優(yōu)化三要素視頻推廣平臺(tái)
  • 小程序 網(wǎng)站 開發(fā)廈門百度推廣開戶
  • 深圳建站推廣公司b站視頻推廣網(wǎng)站
  • 河南省建設(shè)監(jiān)理協(xié)會(huì)網(wǎng)站網(wǎng)站推廣的途徑和方法
  • 著名的國外設(shè)計(jì)網(wǎng)站廣州優(yōu)化防控措施
  • 網(wǎng)站開發(fā)如何讓圖片加載的更快第一推廣網(wǎng)
  • 做網(wǎng)站對客戶有什么幫助外包網(wǎng)絡(luò)推廣公司
  • wap網(wǎng)站適配競價(jià)托管外包
  • 微信小程序是免費(fèi)的嗎seo工程師是什么職業(yè)
  • 怎么用網(wǎng)站后臺(tái)做輪播圖打開百度網(wǎng)站
  • 廣州哪家做網(wǎng)站價(jià)格好百度熱搜榜排名
  • 六安網(wǎng)站推廣獲客app第一接單網(wǎng)app地推和拉新
  • wex5 wordpressseo整站優(yōu)化公司持續(xù)監(jiān)控
  • 專業(yè)網(wǎng)站設(shè)計(jì)服務(wù)seo關(guān)鍵字優(yōu)化軟件
  • 企業(yè)網(wǎng)站做seo輿情報(bào)告范文
  • 寧波北侖網(wǎng)站建設(shè)上海seo外包
  • 建網(wǎng)站域名注冊后需要網(wǎng)絡(luò)營銷所學(xué)課程
  • 專業(yè)做域名的網(wǎng)站線上營銷平臺(tái)
  • 張家港網(wǎng)站建設(shè)門店推廣下載app賺錢
  • 武漢企業(yè)做網(wǎng)站找哪家好收錄排名好的發(fā)帖網(wǎng)站
  • 清河做網(wǎng)站哪家好怎么請專業(yè)拓客團(tuán)隊(duì)