• Spring 一二事(5)


     1     <!-- 依赖注入的装配过程 -->
     2     <bean id="person" class="com.lee.spring007.di.xml.setter.Person">
     3         <property name="pid" value="1001"></property>
     4 
     5         <property name="name" value="nathan"></property>
     6 
     7         <property name="stu" ref="student"></property>
     8 
     9         <property name="list">
    10             <list>
    11                 <value>a</value>
    12                 <value>b</value>
    13                 <value>c</value>
    14                 <value>d</value>
    15                 <value>e</value>
    16             </list>
    17         </property>
    18 
    19         <property name="map">
    20             <map>
    21                 <entry key="number" value="111"></entry>
    22                 <entry key="bean" value-ref="student"></entry>
    23             </map>
    24         </property>
    25 
    26         <property name="properties">
    27             <props>
    28                 <prop key="one">111</prop>
    29                 <prop key="two">222</prop>
    30                 <prop key="three">333</prop>
    31             </props>
    32         </property>
    33 
    34         <property name="sets">
    35             <set>
    36                 <value>11</value>
    37                 <ref bean="student" />
    38             </set>
    39         </property>
    40 
    41         <property name="obj">
    42             <list>
    43                 <value>a</value>
    44                 <value>b</value>
    45                 <value>c</value>
    46                 <value>d</value>
    47                 <value>e</value>
    48             </list>
    49         </property>
    50 
    51     </bean>
    52     <bean id="student" class="com.lee.spring007.di.xml.setter.Student"></bean>
     1 package com.lee.spring007.di.xml.setter;
     2 
     3 import java.util.List;
     4 import java.util.Map;
     5 import java.util.Properties;
     6 import java.util.Set;
     7 
     8 public class Person {
     9     private int pid;
    10     private String name;
    11     private Student stu;
    12     private List list;
    13     private Set sets;
    14     private Map map;
    15     private Properties properties;
    16     private Object[] obj;
    17     public int getPid() {
    18         return pid;
    19     }
    20     public void setPid(int pid) {
    21         this.pid = pid;
    22     }
    23     public String getName() {
    24         return name;
    25     }
    26     public void setName(String name) {
    27         this.name = name;
    28     }
    29     public Student getStu() {
    30         return stu;
    31     }
    32     public void setStu(Student stu) {
    33         this.stu = stu;
    34     }
    35     public List getList() {
    36         return list;
    37     }
    38     public void setList(List list) {
    39         this.list = list;
    40     }
    41     public Map getMap() {
    42         return map;
    43     }
    44     public void setMap(Map map) {
    45         this.map = map;
    46     }
    47     public Properties getProperties() {
    48         return properties;
    49     }
    50     public void setProperties(Properties properties) {
    51         this.properties = properties;
    52     }
    53     public Object[] getObj() {
    54         return obj;
    55     }
    56     public void setObj(Object[] obj) {
    57         this.obj = obj;
    58     }
    59     public Set getSets() {
    60         return sets;
    61     }
    62     public void setSets(Set sets) {
    63         this.sets = sets;
    64     }
    65     
    66 }
    1 package com.lee.spring007.di.xml.setter;
    2 
    3 public class Student {
    4 
    5     public static void say() {
    6         System.out.println("I am a student!");
    7     }
    8 }

     github地址:https://github.com/leechenxiang/maven-spring001-helloworld

  • 相关阅读:
    char *s 和char s[]的区别
    Loadrunner时间函数、用时间生成订单编号例子
    loadrunner获取毫秒及字符串替换实现
    关联的特殊应用
    LR中的时间戳函数web_save_timestamp_param
    使用 If-Then-Else 逻辑进行分支
    ArcGIS中国工具3.2新功能
    运行模型,COM错误,解决问题步骤
    arcgis python 更新日期为随机数
    使用LAS数据集创建DEM和DSM
  • 原文地址:https://www.cnblogs.com/leechenxiang/p/5305409.html
Copyright © 2020-2023  润新知