diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/.idea/workspace.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/.idea/workspace.xml" new file mode 100644 index 0000000000000000000000000000000000000000..9b37d95f0d71d59353b2f9e7bcb2bc53a5b606cb --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/.idea/workspace.xml" @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1671349368206 + + + + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/1\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/1\344\275\234\344\270\232.sql" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/1\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/1\344\275\234\344\270\232.sql" new file mode 100644 index 0000000000000000000000000000000000000000..e4fa757ecbf1f4b6b04e3e7f7fa30540bdc6000e --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/1\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/1\344\275\234\344\270\232.sql" @@ -0,0 +1,27 @@ +-- 创建一个库(MI),并且指定编码集为UTF-8 +CREATE DATABASE `MI` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; + +-- 创建权限表先丢弃原表 +DROP TABLE IF EXISTS USER; +CREATE TABLE `权限表` +( + `id` CHAR(10) DEFAULT NULL, + `名字` VARCHAR(10) DEFAULT NULL, + `电话` CHAR(20) DEFAULT NULL, + `性别` VARCHAR(10) DEFAULT NULL, + `日期` VARCHAR(10) DEFAULT NULL +) ENGINE=INNODB DEFAULT CHARSET=dec8 + +-- 添加5行数据,其中一行数据只添加性别 +INSERT INTO 权限表(id,名字,电话,性别,日期) VALUES('NULL','NULL','NULL','women','NULL'), +('02','yuqi','123456','women','2022-12-15'), +('03','duli','1234567','women','2022-12-14'), +('04','jiajia','12345678','women','2022-12-13'), +('05','xiayu','2345','women','2022-12-12'); + +-- 修改2条数据,第一次修改名字,第二次修改性别 +UPDATE 权限表 SET 名字='xiaoling' WHERE 名字='yuqi' +UPDATE 权限表 SET 性别='men' WHERE 名字='jiajia' + +-- 删除一条数据,按照电话号删除 +DELETE FROM 权限表 WHERE 电话='2345' \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250.iml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250.iml" new file mode 100644 index 0000000000000000000000000000000000000000..48b551b368480ec833ae66a7bac5604b63ce974c --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250.iml" @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" new file mode 100644 index 0000000000000000000000000000000000000000..d9ee4cceedadb308f3ebbeadd880cfd6fb6e2467 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" new file mode 100644 index 0000000000000000000000000000000000000000..95bb8451a7d70fc7a69d735899df3e37b474693c --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lorem1 + lorem2 + lorem3 + + + le1 + le1 + le1 + + + + + + + + + 1 + 2 + 3 + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" new file mode 100644 index 0000000000000000000000000000000000000000..e1c9196a4f9a2734e82839e594d88ae50b384d59 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" @@ -0,0 +1,3 @@ +name=Alya +age=21 +sex=? \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" new file mode 100644 index 0000000000000000000000000000000000000000..9f88c1f9632445500e3b3688fe477b860f77d8f2 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" new file mode 100644 index 0000000000000000000000000000000000000000..c38169bb958579c635a5c09ee2f379cc5956c0c2 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" @@ -0,0 +1,5 @@ + + +

Hello World!

+ + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" new file mode 100644 index 0000000000000000000000000000000000000000..3d102173c77a6ee48eea26ce476aa97b4324c997 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" @@ -0,0 +1,29 @@ +//package cn.tedu.work2; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.stereotype.Component; +// +//@Component("contest") +//public class Contest { +// @Autowired +// @Qualifier("apple") +// private apple ; +// @Autowired +// private banana banana; +// +// public banana getbanana() { +// return banana; +// } +// +// public void set banana(banana b) { +// this.banana = b; +// } +// +// @Override +// public String toString() { +// return "Contest{" + +// "banana=" + banana + +// '}'; +// } +//} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" new file mode 100644 index 0000000000000000000000000000000000000000..4bb95d0347225a0d1a3a43b14dfe77698904ccd7 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" @@ -0,0 +1,85 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +@Component("demo") +public class Demo { + @Value("Alya") + String name; + @Value("21") + int age; + @Value("#{@list1}") + List list; + @Value("#{@set1}") + Set set; + @Value("#{@map1}") + Map map; + @Value("#{@pro1}") + Properties properties; + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public List getList() { + return list; + } + + public Set getSet() { + return set; + } + + public Map getMap() { + return map; + } + + public Properties getProperties() { + return properties; + } + + public void setName(String name) { + this.name = name; + } + + public void setAge(int age) { + this.age = age; + } + + public void setList(List list) { + this.list = list; + } + + public void setSet(Set set) { + this.set = set; + } + + public void setMap(Map map) { + this.map = map; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + @Override + public String toString() { + return "Demo{" + + "name='" + name + '\'' + + ", age=" + age + + ", list=" + list + + ", set=" + set + + ", map=" + map + + ", properties=" + properties + + '}'; + } +} + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" new file mode 100644 index 0000000000000000000000000000000000000000..90071b589d1140a772e69f2458c0e1188fdf47d0 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" @@ -0,0 +1,23 @@ +//package cn.tedu.work2; +// +//import org.springframework.stereotype.Component; +// +//import javax.annotation.PostConstruct; +//import javax.annotation.PreDestroy; +// +//@Component("net") +//public class Net { +// @PostConstruct +// void myInint(){ +// System.out.println("数据库连接"); +// } +// void myadd(){ +// System.out.println("数据添加"); +// } +// void up(){ +// System.out.println("数据更新"); +// } +// @PreDestroy +// void destory(){ +// System.out.println("数据摧毁"); +// } \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" new file mode 100644 index 0000000000000000000000000000000000000000..989b734df377564b17ea673554d9cf00372bfc31 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" @@ -0,0 +1,47 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component("person") +public class Person { + @Value("${name}") + private String name; + @Value("${age}") + private int age; + @Value("${sex}") + private String sex; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + @Override + public String toString() { + return "Person{" + + "name='" + name + '\'' + + ", age=" + age + + ", sex='" + sex + '\'' + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" new file mode 100644 index 0000000000000000000000000000000000000000..0e852adc88adac0ba6e7d978d2945adf32b65fe6 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" @@ -0,0 +1,38 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component("run") +public class Run { + @Autowired + @Qualifier("apple") + private apple; + @Autowired() + private orange; + + public apple getapple() { + return apple; + } + + public void setapple(apple ) { + this.apple = apple; + } + + public orange getorange() { + return orange; + } + + public void setorange(orange) { + this.orange = orange; + } + + @Override + public String toString() { + return "Run{" + + "apple=" + apple + + ", orange=" + orange + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" new file mode 100644 index 0000000000000000000000000000000000000000..e434444c2072cc519413452a95138fbeec4ed5da --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" @@ -0,0 +1,33 @@ +package cn.tedu.work; + +import org.springframework.stereotype.Component; + +@Component("Teacher1") +public class Teacher { + String name; + String id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "Water{" + + "name='" + name + '\'' + + ", id='" + id + '\'' + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" new file mode 100644 index 0000000000000000000000000000000000000000..fe0f3d1ee735c5e9b61c6831b236e52b75350c40 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" @@ -0,0 +1,70 @@ +package cn.tedu.work; + +import org.junit.jupiter.api.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +public class Test { +// @Test +// void test(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Demo demo=(Demo) ac.getBean("Demo"); +// System.out.println(demo); +// +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test1(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Contest demo=(Contest) ac.getBean("context"); +// System.out.println(demo); +// +// ((ClassPathXmlApplicationContext)ac).close(); +//// } +// @Test +// void test2(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Teacher demo=(Teacher) ac.getBean("teacher1"); +// demo.setId("121"); +// demo.setName("Alya"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test3(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Net demo= (Net) ac.getBean("net"); +// demo.myadd(); +// demo.up(); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test4(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Demo demo= (Demo) ac.getBean("demo"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test5(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Contest demo= (Contest) ac.getBean("contest"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } + @Test + void test6(){ + ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); + Run demo= (Run) ac.getBean("run"); + System.out.println(demo); + ((ClassPathXmlApplicationContext)ac).close(); + } + @Test + void test7(){ + ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); + Person person= (Person) ac.getBean("person"); + System.out.println(person); + ((ClassPathXmlApplicationContext)ac).close(); + } + + +} \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" new file mode 100644 index 0000000000000000000000000000000000000000..4799ad1d78c8bb15e83fd4d9de47a76190d82ea5 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" @@ -0,0 +1,12 @@ +package cn.tedu.work; + +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Component("apple") +@Scope("prototype") +public class apple { + void cry(){ + System.out.println("hello apple!"); + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" new file mode 100644 index 0000000000000000000000000000000000000000..d34a32055c8e8a89d460b4f65a37ad15b2cb3845 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" @@ -0,0 +1,10 @@ +package cn.tedu.work; + +//@Component("b") +//@Scope("prototype") +//@Lazy +//public class banana { +// banana(){ +// System.out.println("软又糯"); +// } +//} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" new file mode 100644 index 0000000000000000000000000000000000000000..efd00645df1e40be5f3cdf7c85705cd59ef75f62 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/2\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" @@ -0,0 +1,10 @@ +package cn.tedu.work; + +import org.springframework.stereotype.Component; + +@Component +public class orange { + void shout(){ + System.out.println("甜又酸"); + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" new file mode 100644 index 0000000000000000000000000000000000000000..c5d8f5c51cd70311531ffda1f0fa6c13b92abd4d --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/applicationContext.xml" @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" new file mode 100644 index 0000000000000000000000000000000000000000..df8e387c12f7cd13f5e3acccde7a0d5d20f01b11 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/beans.xml" @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lorem1 + lorem2 + lorem3 + + + le1 + le1 + le1 + + + + + + + + + 1 + 2 + 3 + + + \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" new file mode 100644 index 0000000000000000000000000000000000000000..e1c9196a4f9a2734e82839e594d88ae50b384d59 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/resources/demo.properties" @@ -0,0 +1,3 @@ +name=Alya +age=21 +sex=? \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" new file mode 100644 index 0000000000000000000000000000000000000000..9f88c1f9632445500e3b3688fe477b860f77d8f2 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/WEB-INF/web.xml" @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" new file mode 100644 index 0000000000000000000000000000000000000000..c38169bb958579c635a5c09ee2f379cc5956c0c2 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/webapp/index.jsp" @@ -0,0 +1,5 @@ + + +

Hello World!

+ + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" new file mode 100644 index 0000000000000000000000000000000000000000..84bd115510bf60858b5bcdfa524c73e8b0df1b23 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Contest.java" @@ -0,0 +1,29 @@ +//package cn.tedu.work2; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.stereotype.Component; +// +//@Component("contest") +//public class Contest { +// @Autowired +// @Qualifier("apple") +// private apple ; +// @Autowired +// private banana banana; +// +// public banana getbanana() { +// return banana; +// } +// +// public void setbanana(banana b) { +// this.banana = b; +// } +// +// @Override +// public String toString() { +// return "Contest{" + +// "banana=" + banana + +// '}'; +// } +//} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" new file mode 100644 index 0000000000000000000000000000000000000000..4bb95d0347225a0d1a3a43b14dfe77698904ccd7 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Demo.java" @@ -0,0 +1,85 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +@Component("demo") +public class Demo { + @Value("Alya") + String name; + @Value("21") + int age; + @Value("#{@list1}") + List list; + @Value("#{@set1}") + Set set; + @Value("#{@map1}") + Map map; + @Value("#{@pro1}") + Properties properties; + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public List getList() { + return list; + } + + public Set getSet() { + return set; + } + + public Map getMap() { + return map; + } + + public Properties getProperties() { + return properties; + } + + public void setName(String name) { + this.name = name; + } + + public void setAge(int age) { + this.age = age; + } + + public void setList(List list) { + this.list = list; + } + + public void setSet(Set set) { + this.set = set; + } + + public void setMap(Map map) { + this.map = map; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + @Override + public String toString() { + return "Demo{" + + "name='" + name + '\'' + + ", age=" + age + + ", list=" + list + + ", set=" + set + + ", map=" + map + + ", properties=" + properties + + '}'; + } +} + diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" new file mode 100644 index 0000000000000000000000000000000000000000..22e1f4486b168f460367e798f787b552437f9419 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Net.java" @@ -0,0 +1,24 @@ +//package cn.tedu.work2; +// +//import org.springframework.stereotype.Component; +// +//import javax.annotation.PostConstruct; +//import javax.annotation.PreDestroy; +// +//@Component("net") +//public class Net { +// @PostConstruct +// void myInint(){ +// System.out.println("数据库连接"); +// } +// void myadd(){ +// System.out.println("数据添加"); +// } +// void up(){ +// System.out.println("数据更新"); +// } +// @PreDestroy +// void destory(){ +// System.out.println("数据摧毁"); +// } +//} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" new file mode 100644 index 0000000000000000000000000000000000000000..989b734df377564b17ea673554d9cf00372bfc31 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Person.java" @@ -0,0 +1,47 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component("person") +public class Person { + @Value("${name}") + private String name; + @Value("${age}") + private int age; + @Value("${sex}") + private String sex; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + @Override + public String toString() { + return "Person{" + + "name='" + name + '\'' + + ", age=" + age + + ", sex='" + sex + '\'' + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" new file mode 100644 index 0000000000000000000000000000000000000000..ea08a766818ecd2b2372cc1713158681c34479fe --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Run.java" @@ -0,0 +1,38 @@ +package cn.tedu.work; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component("run") +public class Run { + @Autowired + @Qualifier("apple") + private apple; + @Autowired() + private orange; + + public apple getapple() { + return apple; + } + + public void setapple(apple) { + this.apple = apple; + } + + public orange getorange() { + return orange; + } + + public void setorange(orange) { + this.orange = orange; + } + + @Override + public String toString() { + return "Run{" + + "apple=" + apple + + ", orange=" + orange + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" new file mode 100644 index 0000000000000000000000000000000000000000..618ca551110f2b892d258f2af429f6299914c6d6 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Teacher.java" @@ -0,0 +1,33 @@ +package cn.tedu.work; + +import org.springframework.stereotype.Component; + +@Component("teacher1") +public class Teacher { + String name; + String id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "Teacher{" + + "name='" + name + '\'' + + ", id='" + id + '\'' + + '}'; + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" new file mode 100644 index 0000000000000000000000000000000000000000..6f84615ad149681d4ae831dbb01abc54cd57e1be --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/Test.java" @@ -0,0 +1,71 @@ +package cn.tedu.work; + +import org.junit.jupiter.api.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +public class Test { +// @Test +// void test(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Demo demo=(Demo) ac.getBean("Demo"); +// System.out.println(demo); +// +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test1(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Contest demo=(Contest) ac.getBean("context"); +// System.out.println(demo); +// +// ((ClassPathXmlApplicationContext)ac).close(); +//// } +// @Test +// void test2(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Teacher demo=(Teacher) ac.getBean("teacher1"); +// demo.setId("121"); +// demo.setName("李健健欸"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test3(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Net demo= (Net) ac.getBean("net"); +// demo.myadd(); +// demo.up(); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test4(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Demo demo= (Demo) ac.getBean("demo"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } +// @Test +// void test5(){ +// ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); +// Contest demo= (Contest) ac.getBean("contest"); +// System.out.println(demo); +// ((ClassPathXmlApplicationContext)ac).close(); +// } + @Test + void test6(){ + ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); + Run demo= (Run) ac.getBean("run"); + System.out.println(demo); + ((ClassPathXmlApplicationContext)ac).close(); + } + //Test类测试方法通过注入加载bean文件 + @Test + void test7(){ + ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); + Person person= (Person) ac.getBean("person"); + System.out.println(person); + ((ClassPathXmlApplicationContext)ac).close(); + } +//编码设置改成utf-8,中文乱码解决 + +} \ No newline at end of file diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" new file mode 100644 index 0000000000000000000000000000000000000000..4799ad1d78c8bb15e83fd4d9de47a76190d82ea5 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/apple.java" @@ -0,0 +1,12 @@ +package cn.tedu.work; + +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Component("apple") +@Scope("prototype") +public class apple { + void cry(){ + System.out.println("hello apple!"); + } +} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" new file mode 100644 index 0000000000000000000000000000000000000000..d34a32055c8e8a89d460b4f65a37ad15b2cb3845 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/banana.java" @@ -0,0 +1,10 @@ +package cn.tedu.work; + +//@Component("b") +//@Scope("prototype") +//@Lazy +//public class banana { +// banana(){ +// System.out.println("软又糯"); +// } +//} diff --git "a/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" new file mode 100644 index 0000000000000000000000000000000000000000..efd00645df1e40be5f3cdf7c85705cd59ef75f62 --- /dev/null +++ "b/20202501836-\351\230\277\345\212\233\344\272\232-\344\275\234\344\270\232\345\205\250/3\344\275\234\344\270\232-20202501836-\351\230\277\345\212\233\344\272\232/work/orange.java" @@ -0,0 +1,10 @@ +package cn.tedu.work; + +import org.springframework.stereotype.Component; + +@Component +public class orange { + void shout(){ + System.out.println("甜又酸"); + } +}