<bean id="studentDao" class="oe.spring.StudentDaoImpl">
<property name="school">
<value>shida</value>
</property>
<property name="address">
<value>cangshan</value>
</property>
<property name="">
<list>
<value>90</value>
<value>80</value>
<value>50</value>
</list>
</bean>

解决方案 »

  1.   

    应该是这样的吧,这是一个Spring的BeanFactory配置文件生成一个StudentDaoImpl单例对象
    public BeanFactory
    {
        private static StudentDaoImpl dao;
        
        private DaoFactory(){}
        public static StudentDaoImpl getDao(){
           if(dao == null){
              dao = new StudentDaoImpl()
              dao.setSchool("shida");
              dao.setAddress("cangshan");
              List list = new ArrayList();
              list.add(new Integer(90));
              list.add(new Integer(80));
              list.add(new Integer(50));
              dao.setMark(list);
           }
           return dao;
        }
    }
      

  2.   

    yun虽然我spring不太会但是明显看的出这是Spring的属性拄入!spring  ioc机制和aop是两大特点!这正是ioc
    import java.util.ArrayList;
    import java.util.List;public class Test { /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO 自动生成方法存根 StudentDaoImpl student = new StudentDaoImpl();
    student.setSchool("shida");
    student.setAddress("cangshan");
    List list = new ArrayList();
    list.add(90);
    list.add(80);
    list.add(50);
    student.setMark(list); }}class StudentDaoImpl { private String school; private String address; private List ; public String getAddress() {
    return address;
    } public void setAddress(String address) {
    this.address = address;
    } public List getMark() {
    return ;
    } public void setMark(List ) {
    this. = ;
    } public String getSchool() {
    return school;
    } public void setSchool(String school) {
    this.school = school;
    }}
      

  3.   

    轻量级的Spring技术在一定程度上改变了我们传统意义上的Java编程模式.基于配置模式的脚本编程.这种改变给我们的编程带来了很多的好处,比如:代码间的耦合度更小,具有组件式的差拔特性,更好管理工程模块.
       import java.util.ArrayList;
    import java.util.List;
    public class Util { /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO 自动生成方法存根
                     StudentDaoImpl student = new StudentDaoImpl();
    student.setSchool("shida");
    student.setAddress("cangshan");
    List list = new ArrayList();
    list.add(90);
    list.add(80);
    list.add(50);
    student.setMark(list); }
    }
               class StudentDaoImpl{},set和get方法在spring 注入时生成!!
      

  4.   

    StudentDaoImpl studentDao = new StudentDaoImpl();
    studentDao.setSchool("shida");
    studentDao.setAddress("cangshan");
    List list = new ArrayList();
    list.add("90");
    list.add("80");
    list.add("50");
    studentDao.setMark(new ArrayList());
      

  5.   


    import java.util.*;
    import oe.spring.StudentDaoImplpublic class Untitled3 {
      public Untitled3() {
      }  public void good() {
        StudentDaoImpl studentDao = new StudentDaoImpl();
        studentDao.setSchool("shida");
        studentDao.setAddress("cangshan");
        List list = new ArrayList();
        list.add("90");
        list.add("80");
        list.add("50");
        studentDao.setMark(new ArrayList());
      }
    }