diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/1\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262.sql" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/1\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262.sql" new file mode 100644 index 0000000000000000000000000000000000000000..ad66e370def2ed147263150d72d346ad698f8c43 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/1\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262.sql" @@ -0,0 +1,17 @@ +create database if not EXISTS `mi` + default character set utf8 +drop table [if exists]`权限表`; +create table if not exists `权限表`( +`ID` int(10), +`名字` vachar(15), +`电话` int(15), +`性别` vachar(5), +`日期` vachar(15) +)ENGINE INNODB CHARSET='gbk'; +insert into `权限表` values(1,"李四",15261543521,"男",2000-1-12); +insert into `权限表` (ID,`名字`,`电话`,`性别`,`日期`)value(NULL,NULL,NULL,"女",NULL); +insert into `权限表` values(3,"张三",12340567892,"男",2001-2-10); +insert into `权限表` values(4,"王五",132450657895,"男",2001-5-4); +insert into `权限表` values(5,"韩梅梅",12352402658,"女",2002-1-1); +updata `权限表` set [`名字`="李雷"]where (ID=3); +delete from `权限表` where `电话`=15261543521; \ No newline at end of file diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Context.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Context.java" new file mode 100644 index 0000000000000000000000000000000000000000..0bda9bb54dc12aef3748883c24a1ae15fe402f9f --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Context.java" @@ -0,0 +1,28 @@ +public class Context { + private Aplle aplle; + private Banana banana; + public banana getBanana(){ + return banana; + } + public Aplle getAplle(){ + return aplle; + } + + public void setAplle(Aplle aplle) { + this.aplle = aplle; + } + + public void setBanana(Banana banana) { + this.banana = banana; + } + + @Override + public String toString() { + return "Context{" + + "banana=" + banana + + ", aplle=" + aplle + + '}'; + } + + +} diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test1.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test1.java" new file mode 100644 index 0000000000000000000000000000000000000000..ca252bd37ed81ee1ca54a42ef4fd227548f5f087 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test1.java" @@ -0,0 +1,12 @@ +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + + +public void Test2(){ + ApplicationContext b=new ClassPathXmlApplicationContext("beans.xml"); + Context context=(Context)b.getBean("context"); + System.out.println(context); + ((ClassPathXmlApplicationContext)b).close(); +} + diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" new file mode 100644 index 0000000000000000000000000000000000000000..a4386d0f4b2d954aa1501f96f8fe12e5cdeef15c --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" @@ -0,0 +1,54 @@ +import java.util.List; +import java.util.Properties; +import java.util.Set; + + +public class Ya{ + private String name; + private List list; + private Set set; + private Properties properties; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public Set getSet() { + return set; + } + + public void setSet(Set set) { + this.set = set; + } + + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + @Override + public String toString() { + return "Demo{" + + "name='" + name + '\'' + + ", list=" + list + + ", set=" + set + + ", properties=" + properties + + '}'; + } +} \ No newline at end of file diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" new file mode 100644 index 0000000000000000000000000000000000000000..f155219c73919a439dddbf587ea42f07db0d30c2 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/beans.xml" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/beans.xml" new file mode 100644 index 0000000000000000000000000000000000000000..7ecd9e2aa5150e2efbaf868d35cc704432268f05 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/beans.xml" @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/ya.properties" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/ya.properties" new file mode 100644 index 0000000000000000000000000000000000000000..a663db8a75ee5446abfc3763ac0d3f6d97414efd --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/2\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/ya.properties" @@ -0,0 +1,2 @@ +uname=杨晓玲 +uage=20 diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Pear.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Pear.java" new file mode 100644 index 0000000000000000000000000000000000000000..f0093e5b49d549817fdc7fd29f413d0dac955b2d --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Pear.java" @@ -0,0 +1,24 @@ +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +@Component("p") +public class Pear { + @Value("梨") + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Pear{" + + "name='" + name + '\'' + '}'; + } +} diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test.java" new file mode 100644 index 0000000000000000000000000000000000000000..c11b1aa5eef45a62e7a178055815755c9849f384 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Test.java" @@ -0,0 +1,14 @@ +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + + +public class Test { + @Test + public void test1(){ + ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml"); + Ya a=(Ya)b.getBean("ya"); + System.out.println(a); + ((ClassPathXmlApplicationContext)b).close(); + } +} \ No newline at end of file diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" new file mode 100644 index 0000000000000000000000000000000000000000..609e31b5ce20c7f8c5b2f56191f3e05eac20a80e --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/day/Ya.java" @@ -0,0 +1,82 @@ +import javafx.application.Application; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Properties; +import java.util.Set; + + +@Component +public class Demo { + @Value("${uname}") + private String name; + @Value("#{@list1}") + private List list; + @Value("#{@set1}") + private Set set; + @Value("#{@properties1}") + private Properties properties; + /*设置引用类型:DI注入*/ + // @Autowired 实现自动装配的注解,可以完成自定义bean类型属性的注入 + //说明:先按照类型进行匹配,如果找到唯一的就注入 + // 如果找不到,就按照id进行注入,如果都找不到,抛出异常 + @Autowired + @Qualifier("a") + private Pear a; + + public Pear geta() { + return a; + } + + public void seta(Pear a) { + this.a = a; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public Set getSet() { + return set; + } + + public void setSet(Set set) { + this.set = set; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + @Override + public String toString() { + return "Ya{" + + "name='" + name + '\'' + + ", list=" + list + + ", set=" + set + + ", properties=" + properties + + ", a=" + a + + '}'; + } +} diff --git "a/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" new file mode 100644 index 0000000000000000000000000000000000000000..5bd38628b58c88fe24e882a2836b84b35700f0a1 --- /dev/null +++ "b/\346\235\250\346\231\223\347\216\262-20202501474-\344\275\234\344\270\232\357\274\21027\347\217\255-\345\205\250\357\274\211/3\344\275\234\344\270\232-20202501474-\346\235\250\346\231\223\347\216\262/resources/applicationContext.xml" @@ -0,0 +1,22 @@ + + + + + + +