
Spring5
Chosen_1999
这个作者很懒,什么都没留下…
展开
-
SpringBean的使用
定义员工类,类名EMP public class Emp(){ //定义属性 //员工姓名 private String ename; //员工性别 private String gender; //定义Dept对象值 private String dept; //定义一个Dept部门类 public Dept getDept(){ return dept; } private void setDept(Dept dept){ this.dept = dept; } //使用原创 2021-09-17 15:48:18 · 134 阅读 · 0 评论 -
Spring5学习笔记
Spring5学习笔记 1、首先创建实体类 Chosen1 属性值随便定义 第一种可使用set方法注入 第二种可使用有参数构造注入 创建类,定义属性,创建属性的有参数方法 在最下面定义了Puff方法,使用对象调用进行输出 2.创建bean1.xml,基于xml方法注入 创建对象标签 3.测试Chosen1类 ApplicationContext context = new ClassPathXmlApplicationContext(“xml文件”)加载Spring的配置文件 context.原创 2021-09-17 13:13:00 · 102 阅读 · 0 评论