创建实验室人员管理LabPeopleManagement实体类

main
your-name 1 week ago
parent 42c13f212c
commit f077851623

@ -3,7 +3,11 @@
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的创建实例化Student对象实现Student student=new Student();效果 -->
<bean id="student" class="com.ssm.ioc.Student">
<!-- 完成Bean的创建实例化Student对象实现Student labPeopleManagement=new Student();效果 -->
<bean id="labPeopleManagement" class="com.ssm.ioc.LabPeopleManagement">
<property name="stuName" value="小王"/>
<property name="stuNo" value="20170101"/>
<property name="tcrName" value="李老师"/>
<property name="tcrNo" value="xinxi033"/>
</bean>
</beans>

@ -0,0 +1,28 @@
package com.ssm.ioc;
public class LabPeopleManagement {
private String tcrName;
private String stuName;
private String tcrNo;
private String stuNo;
public String getStuNo() {
return stuNo;
}
public void setStuNo(String stuNo) {
this.stuNo = stuNo;
}
public String getTcrNo() {return tcrNo;}
public void setTcrNo(String tcrNo) {this.tcrNo = tcrNo;}
public String getTcrName() {return tcrName;}
public void setTcrName(String tcrName) {
this.tcrName = tcrName;
}
public String getStuName() {
return stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
}

@ -1,32 +0,0 @@
package com.ssm.ioc;
public class Student {
private String stuNo;
private String stuName;
private int stuAge;
public int getStuAge() {
return stuAge;
}
public void setStuAge(int stuAge) {
this.stuAge = stuAge;
}
public String getStuNo() {
return stuNo;
}
public void setStuNo(String stuNo) {
this.stuNo = stuNo;
}
public String getStuName() {
return stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
}

@ -1,6 +1,5 @@
package com.ssm.ioc;
import com.ssm.ioc.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -8,8 +7,8 @@ public class TestIoC {
public static void main(String[] args) {
// 初始化Spring容器加载文件bean-ioc.xml
ApplicationContext context = new ClassPathXmlApplicationContext("bean-ioc.xml");
// 获取student
Student stu = (Student) context.getBean("student");
System.out.println(stu);
// 获取 labmng
LabPeopleManagement lab = (LabPeopleManagement) context.getBean("labPeopleManagement");
System.out.println(lab);
}
}

@ -2,7 +2,7 @@ package com.ssm.ioc;
public class TestNew {
public static void main(String[] args) {
Student student = new Student();
System.out.println(student);
LabPeopleManagement labPeopleManagement = new LabPeopleManagement();
System.out.println(labPeopleManagement);
}
}

Loading…
Cancel
Save