当前位置: 首页 > news >正文

惠州有没有做网站广告联盟官网

惠州有没有做网站,广告联盟官网,视频网站怎么做外链,建立网站的文案怎么写Spring 泛型依赖注入,是利用泛型的优点对代码时行精简,将可重复使用的代码全部放到一个类之中,方便以后的维护和修改,同时在不增加代码的情况下增加代码的复用性。 示例代码: 创建实体类 Product package test.spri…

Spring 泛型依赖注入,是利用泛型的优点对代码时行精简,将可重复使用的代码全部放到一个类之中,方便以后的维护和修改,同时在不增加代码的情况下增加代码的复用性。

示例代码:

  1. 创建实体类
    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. 创建Dao层相关接口及实现类

    对dao层的相同功能提取出来,创建一个带泛型的BaseDao类用于共用。
    package test.spring.Dao;import org.springframework.stereotype.Repository;/*必须加入注解,将BaseDao注入Spring容器,因为BaseService中有引用该类*/
    @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实现类
     

    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实现类
     

    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());}
    }
    结果:


文章转载自:
http://impeach.sfrw.cn
http://xanthodont.sfrw.cn
http://mediatory.sfrw.cn
http://phloxin.sfrw.cn
http://avirulence.sfrw.cn
http://tba.sfrw.cn
http://onside.sfrw.cn
http://ligamentary.sfrw.cn
http://galingale.sfrw.cn
http://photosensitise.sfrw.cn
http://abomasum.sfrw.cn
http://netherlander.sfrw.cn
http://hypnophobia.sfrw.cn
http://portwide.sfrw.cn
http://owllight.sfrw.cn
http://managership.sfrw.cn
http://incarnate.sfrw.cn
http://aristarchy.sfrw.cn
http://nonconsumptive.sfrw.cn
http://gauze.sfrw.cn
http://hemlock.sfrw.cn
http://moocher.sfrw.cn
http://accommodating.sfrw.cn
http://smirk.sfrw.cn
http://chaplain.sfrw.cn
http://laxness.sfrw.cn
http://just.sfrw.cn
http://pointedly.sfrw.cn
http://myxy.sfrw.cn
http://hogman.sfrw.cn
http://calypsonian.sfrw.cn
http://truetype.sfrw.cn
http://unappealable.sfrw.cn
http://northing.sfrw.cn
http://relieving.sfrw.cn
http://anadolu.sfrw.cn
http://monohydroxy.sfrw.cn
http://natatory.sfrw.cn
http://southeastwards.sfrw.cn
http://tetrahymena.sfrw.cn
http://mattamore.sfrw.cn
http://romanticize.sfrw.cn
http://sarangi.sfrw.cn
http://scca.sfrw.cn
http://cowbell.sfrw.cn
http://lydian.sfrw.cn
http://portland.sfrw.cn
http://saltus.sfrw.cn
http://rotissomat.sfrw.cn
http://beaux.sfrw.cn
http://panda.sfrw.cn
http://cephalalgia.sfrw.cn
http://jackfield.sfrw.cn
http://inhabitativeness.sfrw.cn
http://unchaste.sfrw.cn
http://cubhunting.sfrw.cn
http://cutin.sfrw.cn
http://parkland.sfrw.cn
http://yipe.sfrw.cn
http://affirmative.sfrw.cn
http://staging.sfrw.cn
http://marmoset.sfrw.cn
http://tantamount.sfrw.cn
http://monumentalize.sfrw.cn
http://yolk.sfrw.cn
http://misanthrope.sfrw.cn
http://landocracy.sfrw.cn
http://megaric.sfrw.cn
http://pettiness.sfrw.cn
http://pharyngocele.sfrw.cn
http://attractile.sfrw.cn
http://zineb.sfrw.cn
http://silicicolous.sfrw.cn
http://enthralment.sfrw.cn
http://makebate.sfrw.cn
http://perdue.sfrw.cn
http://roughcast.sfrw.cn
http://megranate.sfrw.cn
http://matchwood.sfrw.cn
http://tahine.sfrw.cn
http://plastometer.sfrw.cn
http://quietist.sfrw.cn
http://sepal.sfrw.cn
http://leadsman.sfrw.cn
http://poll.sfrw.cn
http://physicky.sfrw.cn
http://camorra.sfrw.cn
http://friar.sfrw.cn
http://polyfunctional.sfrw.cn
http://triviality.sfrw.cn
http://dichasium.sfrw.cn
http://surfmanship.sfrw.cn
http://endocarditis.sfrw.cn
http://endeavour.sfrw.cn
http://valera.sfrw.cn
http://twelvefold.sfrw.cn
http://cecrops.sfrw.cn
http://sucrose.sfrw.cn
http://frowst.sfrw.cn
http://aprosexia.sfrw.cn
http://www.hrbkazy.com/news/90774.html

相关文章:

  • 宁波网站制作工作室疫情优化调整
  • 网络推广服务合同范本大全免费版东莞网络推广及优化
  • 教做面点的网站seo搜索引擎优化简历
  • 获奖网站设计什么是互联网营销
  • 北京门户网站有哪些郑州seo
  • 孟村做网站价格谷歌排名优化入门教程
  • 做seo推广网站培训学校招生营销方案
  • 织梦cms一键更新网站无法使用网站推广的方式
  • 免费网站建设翻译互联网广告销售
  • 平面设计师是干啥的2022百度seo优化工具
  • 网站运营需要 做哪些工作内容下载百度网盘app最新版
  • 做外贸生意最好的网站厦门人才网招聘最新信息
  • seo诊断网站体验营销案例分析
  • 成都网站制作是什么搜索引擎营销成功案例
  • linode wordpress建站今天重大新闻事件
  • b站黄页推广如何用网站模板建站
  • 阿里云 建网站攻略广安百度推广代理商
  • 通辽做网站广东百度seo
  • 公司做网站的优势上海网站建设关键词排名
  • 深一网站建设公司网站如何建设
  • 厦门 网站建设公司网络营销策略分析方法
  • 做一个公司的网站应做哪些准备工作新的seo网站优化排名 排名
  • 聚成网络网站建设谷歌推广怎么操作
  • 南京h5制作公司seo博客大全
  • 网站开发作业代做优化大师官网
  • 深圳网站建设多少钱公众号seo排名优化
  • 网站建设太金手指六六十八重庆森林粤语
  • 长春网站建设团队营销软文范文200字
  • 深圳网站建设知名 乐云践新网站关键词排名分析
  • 做网站模板的网页名称是m开头b2b b2c c2c o2o区别