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

如何开设网站牡丹江网页制作公司

如何开设网站,牡丹江网页制作公司,网站主页不收录,wordpress显示作者信息一、概述 自动装配是根据指定规则(属性名称或者属性类型),Spring自动将匹配的属性值进行注入。 二、分类 xml自动装配分为按照属性名称自动装配(byName)和按照属性类型自动装配(byType)。 2.1…

一、概述

        自动装配是根据指定规则(属性名称或者属性类型),Spring自动将匹配的属性值进行注入。

二、分类

        xml自动装配分为按照属性名称自动装配(byName)和按照属性类型自动装配(byType)

2.1、byName

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Department implements Serializable {/*** 部门名称*/private String name;}@Data
@AllArgsConstructor
@NoArgsConstructor
public class Employee implements Serializable {/*** 员工名称*/private String name;/*** 性别*/private String gender;/*** 部门*/private Department department;
}<?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="employee" class="org.star.entity.Employee" autowire="byName"><property name="name" value="李白"></property><property name="gender" value="男"></property><property name="department" ref="department"></property></bean><bean id="department" class="org.star.entity.Department"><property name="name" value="研发部"></property></bean></beans>/*** IOC操作bean管理(xml自动装配-byName)*/
@Test
public void beanManagementTest12() {ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext12.xml");Employee employee = context.getBean("employee", Employee.class);System.out.println("byName employee = " + employee);
}
// 控制台打印结果
byName employee = Employee(name=李白, gender=男, department=Department(name=研发部))

2.2、byType

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Department implements Serializable {/*** 部门名称*/private String name;}@Data
@AllArgsConstructor
@NoArgsConstructor
public class Employee implements Serializable {/*** 员工名称*/private String name;/*** 性别*/private String gender;/*** 部门*/private Department department;
}<?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="employee" class="org.star.entity.Employee" autowire="byType"><property name="name" value="李白"></property><property name="gender" value="男"></property><property name="department" ref="department"></property></bean><bean id="department" class="org.star.entity.Department"><property name="name" value="研发部"></property></bean></beans>/*** IOC操作bean管理(xml自动装配-byType)*/
@Test
public void beanManagementTest13() {ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext13.xml");Employee employee = context.getBean("employee", Employee.class);System.out.println("byType employee = " + employee);
}
// 控制台打印结果
byType employee = Employee(name=李白, gender=男, department=Department(name=研发部))

http://www.yayakq.cn/news/467094/

相关文章:

  • 做视频网站收费侵权吗简易东莞网站制作公司
  • 中山网站的建设个人公众号申请要钱吗
  • 杭州网站建设交易江门网站排名优化
  • 家用云做网站自己做的网站怎么在百度搜索到
  • 陕西省建设工程造价管理协会网站h5网站开发费用
  • 贵州建设监理网站杭州网站建设seo优化
  • 图库网站模板河南营销型网站
  • 企业建设网站需注意哪些事项布吉网站建设哪家好
  • python做网站实例网页图片动态效果
  • 站长之家网站排行榜哪个网站做设计可以挣钱
  • 哪里有html5网站建设十大战略咨询公司
  • 什么叫做营销型网站合肥专业网站优化费用
  • 商务网站的建设与维护网站换服务器对网站排名有影响吗
  • 佛山正规网站建设报价承德网站建设制作
  • 优秀的电商设计网站有哪些免费的企业黄页网站永久免费
  • 源码开发网站建设网络营销的概念及手段
  • 大理中小企业网站建设免费域名申请网站空间
  • 如何用cms做网站怎么做淘宝网站赚钱技巧
  • 汕头模板网建站泰国一家做男模的网站
  • 江门做网站如何做企业网络营销推广
  • 东莞网站推广优化网站电子政务网站建设要求
  • 新手学纪事本html代码做网站泰州建设网站
  • 网站建设维护总结东莞常平哪里好玩
  • 网站统计模块协同办公软件下载
  • 建设智能网站黔西南州网站建设
  • 云网站建站南昌网站建设索q.479185700
  • 为什么做游戏网站被封海外网站推广方法
  • 有关网站建设的说说个网站能申请贝宝支付接口
  • 怎么使用电脑是做网站网站开发需求分析包括哪些方面
  • 个人网站可以如果做淘宝客wordpress源代码