From 910cb70d1b12ef9e4f812dc0590cbe0edc9a1bb0 Mon Sep 17 00:00:00 2001 From: ytf <2183365846@qq.com> Date: Sun, 22 Sep 2024 11:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++ .../05_SpringMVC_Quick_Start_Web_exploded.xml | 14 ++ .idea/compiler.xml | 25 ++++ .idea/encodings.xml | 16 +++ .idea/jarRepositories.xml | 20 +++ .idea/misc.xml | 19 +++ .idea/modules.xml | 8 ++ .idea/uiDesigner.xml | 124 ++++++++++++++++++ .idea/vcs.xml | 6 + 01-Spring-Quick-Start/pom.xml | 24 ++++ .../src/main/java/stu/example/Main.java | 14 ++ .../java/stu/example/entity/ArtStudent.java | 7 + .../stu/example/entity/SportsStudent.java | 7 + .../main/java/stu/example/entity/Student.java | 7 + .../src/main/resources/application.xml | 7 + .../target/classes/application.xml | 7 + .../target/classes/stu/example/Main.class | Bin 0 -> 832 bytes .../stu/example/entity/ArtStudent.class | Bin 0 -> 527 bytes .../stu/example/entity/SportsStudent.class | Bin 0 -> 538 bytes .../classes/stu/example/entity/Student.class | Bin 0 -> 503 bytes 02-Spring-Dependency-Injection-1/pom.xml | 28 ++++ .../src/main/java/edu/ytf/entity/Main.java | 14 ++ .../edu/ytf/entity/entity/ArtTeacher.java | 8 ++ .../java/edu/ytf/entity/entity/PETeacher.java | 8 ++ .../java/edu/ytf/entity/entity/Student.java | 24 ++++ .../java/edu/ytf/entity/entity/Teacher.java | 5 + .../src/main/resources/application.xml | 11 ++ .../target/classes/application.xml | 11 ++ .../target/classes/edu/ytf/entity/Main.class | Bin 0 -> 986 bytes .../edu/ytf/entity/entity/ArtTeacher.class | Bin 0 -> 562 bytes .../edu/ytf/entity/entity/PETeacher.class | Bin 0 -> 559 bytes .../edu/ytf/entity/entity/Student.class | Bin 0 -> 2461 bytes .../edu/ytf/entity/entity/Teacher.class | Bin 0 -> 139 bytes 03-Spring-Annotate/pom.xml | 30 +++++ 03-Spring-Annotate/src/main/java/Main.java | 11 ++ .../src/main/java/edu/ytf/application.xml | 11 ++ .../edu/ytf/config/MainConfiguration.java | 9 ++ .../main/java/edu/ytf/entity/ArtTeacher.java | 11 ++ .../main/java/edu/ytf/entity/PETeacher.java | 11 ++ .../src/main/java/edu/ytf/entity/Student.java | 19 +++ .../src/main/java/edu/ytf/entity/Teacher.java | 5 + 03-Spring-Annotate/target/classes/Main.class | Bin 0 -> 800 bytes .../edu/ytf/config/MainConfiguration.class | Bin 0 -> 464 bytes .../classes/edu/ytf/entity/ArtTeacher.class | Bin 0 -> 658 bytes .../classes/edu/ytf/entity/PETeacher.class | Bin 0 -> 657 bytes .../classes/edu/ytf/entity/Student.class | Bin 0 -> 591 bytes .../classes/edu/ytf/entity/Teacher.class | Bin 0 -> 132 bytes 04-Spring-Annotate/pom.xml | 33 +++++ .../src/main/java/edu/ytf/Main.java | 13 ++ .../edu/ytf/controller/TestController.java | 15 +++ .../src/main/java/edu/ytf/dao/TestDao.java | 5 + .../main/java/edu/ytf/dao/TestDaoImpl.java | 12 ++ .../java/edu/ytf/service/TestService.java | 6 + .../java/edu/ytf/service/TestServiceImpl.java | 16 +++ .../src/main/resources/application.xml | 7 + .../target/classes/application.xml | 7 + .../target/classes/edu/ytf/Main.class | Bin 0 -> 844 bytes .../edu/ytf/controller/TestController.class | Bin 0 -> 817 bytes .../target/classes/edu/ytf/dao/TestDao.class | Bin 0 -> 128 bytes .../classes/edu/ytf/dao/TestDaoImpl.class | Bin 0 -> 655 bytes .../classes/edu/ytf/service/TestService.class | Bin 0 -> 140 bytes .../edu/ytf/service/TestServiceImpl.class | Bin 0 -> 858 bytes 05-SpringMVC-Quick-Start/pom.xml | 54 ++++++++ .../example/controller/IndexController.java | 15 +++ .../src/main/resources/springmvc.xml | 33 +++++ .../src/main/webapp/WEB-INF/web.xml | 21 +++ .../src/main/webapp/index.jsp | 12 ++ .../target/classes/springmvc.xml | 33 +++++ .../example/controller/IndexController.class | Bin 0 -> 820 bytes 06-SpringBoot-Quick-Start/.gitignore | 33 +++++ 06-SpringBoot-Quick-Start/pom.xml | 76 +++++++++++ .../ytf/springbootquickstart/Application.java | 13 ++ .../controller/ArrayParamsController.java | 27 ++++ .../controller/DateParamsController.java | 20 +++ .../controller/HelloController.java | 18 +++ .../controller/JsonParamsController.java | 14 ++ .../controller/PathParamsController.java | 35 +++++ .../controller/PojoParamsController.java | 27 ++++ .../controller/SimpleParamsController.java | 48 +++++++ .../springbootquickstart/pojo/Address.java | 11 ++ .../ytf/springbootquickstart/pojo/User.java | 20 +++ .../src/main/resources/application.properties | 7 + .../ApplicationTests.java | 13 ++ JavaEE-2024.iml | 9 ++ .../WEB-INF/web.xml | 6 + .../index.jsp | 12 ++ .../web/WEB-INF/web.xml | 6 + 87 files changed, 1206 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/artifacts/05_SpringMVC_Quick_Start_Web_exploded.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 01-Spring-Quick-Start/pom.xml create mode 100644 01-Spring-Quick-Start/src/main/java/stu/example/Main.java create mode 100644 01-Spring-Quick-Start/src/main/java/stu/example/entity/ArtStudent.java create mode 100644 01-Spring-Quick-Start/src/main/java/stu/example/entity/SportsStudent.java create mode 100644 01-Spring-Quick-Start/src/main/java/stu/example/entity/Student.java create mode 100644 01-Spring-Quick-Start/src/main/resources/application.xml create mode 100644 01-Spring-Quick-Start/target/classes/application.xml create mode 100644 01-Spring-Quick-Start/target/classes/stu/example/Main.class create mode 100644 01-Spring-Quick-Start/target/classes/stu/example/entity/ArtStudent.class create mode 100644 01-Spring-Quick-Start/target/classes/stu/example/entity/SportsStudent.class create mode 100644 01-Spring-Quick-Start/target/classes/stu/example/entity/Student.class create mode 100644 02-Spring-Dependency-Injection-1/pom.xml create mode 100644 02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/Main.java create mode 100644 02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/ArtTeacher.java create mode 100644 02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/PETeacher.java create mode 100644 02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Student.java create mode 100644 02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Teacher.java create mode 100644 02-Spring-Dependency-Injection-1/src/main/resources/application.xml create mode 100644 02-Spring-Dependency-Injection-1/target/classes/application.xml create mode 100644 02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/Main.class create mode 100644 02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/ArtTeacher.class create mode 100644 02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/PETeacher.class create mode 100644 02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/Student.class create mode 100644 02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/Teacher.class create mode 100644 03-Spring-Annotate/pom.xml create mode 100644 03-Spring-Annotate/src/main/java/Main.java create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/application.xml create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/config/MainConfiguration.java create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/entity/ArtTeacher.java create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/entity/PETeacher.java create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/entity/Student.java create mode 100644 03-Spring-Annotate/src/main/java/edu/ytf/entity/Teacher.java create mode 100644 03-Spring-Annotate/target/classes/Main.class create mode 100644 03-Spring-Annotate/target/classes/edu/ytf/config/MainConfiguration.class create mode 100644 03-Spring-Annotate/target/classes/edu/ytf/entity/ArtTeacher.class create mode 100644 03-Spring-Annotate/target/classes/edu/ytf/entity/PETeacher.class create mode 100644 03-Spring-Annotate/target/classes/edu/ytf/entity/Student.class create mode 100644 03-Spring-Annotate/target/classes/edu/ytf/entity/Teacher.class create mode 100644 04-Spring-Annotate/pom.xml create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/Main.java create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/controller/TestController.java create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDao.java create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDaoImpl.java create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/service/TestService.java create mode 100644 04-Spring-Annotate/src/main/java/edu/ytf/service/TestServiceImpl.java create mode 100644 04-Spring-Annotate/src/main/resources/application.xml create mode 100644 04-Spring-Annotate/target/classes/application.xml create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/Main.class create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/controller/TestController.class create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/dao/TestDao.class create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/dao/TestDaoImpl.class create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/service/TestService.class create mode 100644 04-Spring-Annotate/target/classes/edu/ytf/service/TestServiceImpl.class create mode 100644 05-SpringMVC-Quick-Start/pom.xml create mode 100644 05-SpringMVC-Quick-Start/src/main/java/stu/example/controller/IndexController.java create mode 100644 05-SpringMVC-Quick-Start/src/main/resources/springmvc.xml create mode 100644 05-SpringMVC-Quick-Start/src/main/webapp/WEB-INF/web.xml create mode 100644 05-SpringMVC-Quick-Start/src/main/webapp/index.jsp create mode 100644 05-SpringMVC-Quick-Start/target/classes/springmvc.xml create mode 100644 05-SpringMVC-Quick-Start/target/classes/stu/example/controller/IndexController.class create mode 100644 06-SpringBoot-Quick-Start/.gitignore create mode 100644 06-SpringBoot-Quick-Start/pom.xml create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/Application.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/ArrayParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/DateParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/HelloController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/JsonParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PathParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PojoParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/SimpleParamsController.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/Address.java create mode 100644 06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/User.java create mode 100644 06-SpringBoot-Quick-Start/src/main/resources/application.properties create mode 100644 06-SpringBoot-Quick-Start/src/test/java/edu/ytf/springbootquickstart/ApplicationTests.java create mode 100644 JavaEE-2024.iml create mode 100644 out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/WEB-INF/web.xml create mode 100644 out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/index.jsp create mode 100644 out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/web/WEB-INF/web.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/artifacts/05_SpringMVC_Quick_Start_Web_exploded.xml b/.idea/artifacts/05_SpringMVC_Quick_Start_Web_exploded.xml new file mode 100644 index 0000000..b4bc415 --- /dev/null +++ b/.idea/artifacts/05_SpringMVC_Quick_Start_Web_exploded.xml @@ -0,0 +1,14 @@ + + + $PROJECT_DIR$/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b4561d9 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..05804d5 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..abb532a --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1a05df --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..90a498a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/01-Spring-Quick-Start/pom.xml b/01-Spring-Quick-Start/pom.xml new file mode 100644 index 0000000..32544c0 --- /dev/null +++ b/01-Spring-Quick-Start/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + stu.example + 01-Spring-Quick-Start + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + org.springframework + spring-context + 6.1.11 + + + + \ No newline at end of file diff --git a/01-Spring-Quick-Start/src/main/java/stu/example/Main.java b/01-Spring-Quick-Start/src/main/java/stu/example/Main.java new file mode 100644 index 0000000..246bfe3 --- /dev/null +++ b/01-Spring-Quick-Start/src/main/java/stu/example/Main.java @@ -0,0 +1,14 @@ +package stu.example; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import stu.example.entity.Student; + +public class Main { + public static void main(String[] args) { + ApplicationContext context = new ClassPathXmlApplicationContext("application.xml"); + //默认使用单例模式 + Student student = (Student) context.getBean("student"); + student.hello(); + } +} diff --git a/01-Spring-Quick-Start/src/main/java/stu/example/entity/ArtStudent.java b/01-Spring-Quick-Start/src/main/java/stu/example/entity/ArtStudent.java new file mode 100644 index 0000000..e4a64ca --- /dev/null +++ b/01-Spring-Quick-Start/src/main/java/stu/example/entity/ArtStudent.java @@ -0,0 +1,7 @@ +package stu.example.entity; + +public class ArtStudent extends Student{ + public void art(){ + System.out.println("我爱画画"); + } +} diff --git a/01-Spring-Quick-Start/src/main/java/stu/example/entity/SportsStudent.java b/01-Spring-Quick-Start/src/main/java/stu/example/entity/SportsStudent.java new file mode 100644 index 0000000..e519dc7 --- /dev/null +++ b/01-Spring-Quick-Start/src/main/java/stu/example/entity/SportsStudent.java @@ -0,0 +1,7 @@ +package stu.example.entity; + +public class SportsStudent extends Student{ + public void sport(){ + System.out.println("我爱运动"); + } +} diff --git a/01-Spring-Quick-Start/src/main/java/stu/example/entity/Student.java b/01-Spring-Quick-Start/src/main/java/stu/example/entity/Student.java new file mode 100644 index 0000000..3204839 --- /dev/null +++ b/01-Spring-Quick-Start/src/main/java/stu/example/entity/Student.java @@ -0,0 +1,7 @@ +package stu.example.entity; + +public class Student { + public void hello(){ + System.out.println("Hello"); + } +} diff --git a/01-Spring-Quick-Start/src/main/resources/application.xml b/01-Spring-Quick-Start/src/main/resources/application.xml new file mode 100644 index 0000000..31bd7b7 --- /dev/null +++ b/01-Spring-Quick-Start/src/main/resources/application.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/01-Spring-Quick-Start/target/classes/application.xml b/01-Spring-Quick-Start/target/classes/application.xml new file mode 100644 index 0000000..31bd7b7 --- /dev/null +++ b/01-Spring-Quick-Start/target/classes/application.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/01-Spring-Quick-Start/target/classes/stu/example/Main.class b/01-Spring-Quick-Start/target/classes/stu/example/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..a0807c4b161978f41668a202a4ca828746af6de6 GIT binary patch literal 832 zcmb7CU2oGc6g}=&+BBmhV+FPW<7>1Vs(CLUu}VC3fK*fs@#JPE^~jeJ7s}7#g$a-l z&-^IFbu!ToCL|KcmhbUB_xRlVzPJHZ1H`TY6hSbCbF z_E1GiKV~R*x?>Al73yu-8!m!>ME~JdKsnzd}>u51pnVucVNH=j2u7x!R zm$1&z`Sv4t)2bUEWdC@NSP#7B}07^+A&%N*&t0jC#`{4d3Tv<@MsO0H3n$$4Uua%sByP&`w+$G$m>Ds|PD$pjC NEp&3dT|!FO{RKX@&9VRh literal 0 HcmV?d00001 diff --git a/01-Spring-Quick-Start/target/classes/stu/example/entity/ArtStudent.class b/01-Spring-Quick-Start/target/classes/stu/example/entity/ArtStudent.class new file mode 100644 index 0000000000000000000000000000000000000000..68a6701dbd68c845c62f882949e9b84d8a643ce7 GIT binary patch literal 527 zcmaKp%T59@6o&tD8)h5@LA>CFxC0l?(gkW_Ok5FTGKPJD25aU*hK`XpU~A%w;6f8k zd;lLr-okha1Y8iC=CtSbo&4?B&-*8UGgK@jkTj68kw%80+*h$99=YH1gd+ka)xdF8 z+@UK&=2Qk!oiik>wWf(IOaqpU71#{93ZG=Bb|Z6S|!0|gsJY%mm;bTJq`&F})kR;S$QL`C6lz1B3a$*{jf z!$m}sXEIWkVMj3J8Zr>qvELHWEpK@gDKx@1_nJJC+Mfke>Q43c*{5s*2funkb%Ou^ literal 0 HcmV?d00001 diff --git a/01-Spring-Quick-Start/target/classes/stu/example/entity/SportsStudent.class b/01-Spring-Quick-Start/target/classes/stu/example/entity/SportsStudent.class new file mode 100644 index 0000000000000000000000000000000000000000..3ee423902dbd990e29e88368ac9e52ea51b109f1 GIT binary patch literal 538 zcmaixxlY4C5QhKFVaLXhkPwb=QzaC*qzKR;QCSGdD7}-c!Xn3x>@^~95K+Nf(1rpe z3g~$cj;BD39TZYTVvCubl|eZWo{&cj>1wT^AqP!`ZeRumL*df7a!l9pI;PzZCGS#~ACahRB^BYDXMymf zEd%a!>p9FZ7$1YX&%yBP_4fVdUPl4*DvAb5SYRkkQ8B2!nBjVat&X^(iIUQtdaa>i zkzs4v4n04R;dqnGvESwlc}sZwH0m~aaPBl+$`mcX<+u$e5OMsQ%*YE7GVECYf$I#} zFrLJq+kO1zcr|RJOiv%56i5bz>=H#Lc}70F`vf*j%FATqGLXg!S!2|I n3RWp%SR0G?6BwX9KrPNbBL4@7KbolYYsv&f8$;Hqn!?5poacIt literal 0 HcmV?d00001 diff --git a/01-Spring-Quick-Start/target/classes/stu/example/entity/Student.class b/01-Spring-Quick-Start/target/classes/stu/example/entity/Student.class new file mode 100644 index 0000000000000000000000000000000000000000..6aacdc1675a4927766a110db749e2057306b1cee GIT binary patch literal 503 zcmZ{hOHaZ;5Xb+^qouV9g80B!ynzRM^niLXF&-K zFf{&1XD}zaIE;zco&)pFh$iDOP)NKP5{y#JA18epUcV6gopO9OEwHP2Z*d7=lw z5t{U``V>F~Fi38Z<&tKk%g3)^PkDHoqz(f`?2vTk320%LENW(1e44`m>ltQ!^##>$ UfZifeX*tFZh_!_5Q?!7CFOZ~X%m4rY literal 0 HcmV?d00001 diff --git a/02-Spring-Dependency-Injection-1/pom.xml b/02-Spring-Dependency-Injection-1/pom.xml new file mode 100644 index 0000000..1e9b452 --- /dev/null +++ b/02-Spring-Dependency-Injection-1/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + stu.example + 02-Spring-Dependency-Injection-1 + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + org.springframework + spring-context + 6.1.11 + + + org.projectlombok + lombok + 1.18.26 + + + \ No newline at end of file diff --git a/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/Main.java b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/Main.java new file mode 100644 index 0000000..ec824ef --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/Main.java @@ -0,0 +1,14 @@ +package edu.ytf.entity; + +import edu.ytf.entity.entity.Student; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Main { + public static void main(String[] args) { + ApplicationContext context = new ClassPathXmlApplicationContext("application.xml"); + Student student = (Student) context.getBean("student"); + student.study(); + System.out.println(student); + } +} diff --git a/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/ArtTeacher.java b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/ArtTeacher.java new file mode 100644 index 0000000..9198309 --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/ArtTeacher.java @@ -0,0 +1,8 @@ +package edu.ytf.entity.entity; + +public class ArtTeacher implements Teacher{ + @Override + public void teach() { + System.out.println("我爱画画"); + } +} diff --git a/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/PETeacher.java b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/PETeacher.java new file mode 100644 index 0000000..5031cee --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/PETeacher.java @@ -0,0 +1,8 @@ +package edu.ytf.entity.entity; + +public class PETeacher implements Teacher{ + @Override + public void teach() { + System.out.println("我爱打球"); + } +} diff --git a/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Student.java b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Student.java new file mode 100644 index 0000000..6e382fd --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Student.java @@ -0,0 +1,24 @@ +package edu.ytf.entity.entity; + +import lombok.Data; + +@Data +public class Student { +// private Teacher teacher = new PETeacher(); + private Teacher teacher; + private String name; + + public void study(){ + teacher.teach(); + } + //构造注入 + public Student(Teacher teacher,String name){ + this.teacher = teacher; + this.name = name; + + } + //要使用依赖注入 要提供一个set方法 +// public void setTeacher(Teacher teacher) { +// this.teacher = teacher; +// } +} diff --git a/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Teacher.java b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Teacher.java new file mode 100644 index 0000000..e53f51a --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/java/edu/ytf/entity/entity/Teacher.java @@ -0,0 +1,5 @@ +package edu.ytf.entity.entity; + +public interface Teacher { + void teach(); +} diff --git a/02-Spring-Dependency-Injection-1/src/main/resources/application.xml b/02-Spring-Dependency-Injection-1/src/main/resources/application.xml new file mode 100644 index 0000000..c8279f2 --- /dev/null +++ b/02-Spring-Dependency-Injection-1/src/main/resources/application.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/02-Spring-Dependency-Injection-1/target/classes/application.xml b/02-Spring-Dependency-Injection-1/target/classes/application.xml new file mode 100644 index 0000000..c8279f2 --- /dev/null +++ b/02-Spring-Dependency-Injection-1/target/classes/application.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/Main.class b/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..6ce0cb6673263c264252b90f78af4cae7b77347f GIT binary patch literal 986 zcmb7DTW=CU6#j-w7nZG5khNZFFKUIhvi1Ienpl!PQEh@D8lMK3(ye>T?yQ!dr4Kf0 zVtn>T8PBjNr4kc&k~x_we%QpZ|@JL4rX$=_zS4dsDF3~V|4ZQ2PZ9VRXr zxU96yDxSkUu3|~UH3Q37nG(1?jHGZ$S3f41D+!+MTl>_kq?QGD8#>l-UBe9nH?hu8 z9%(WiLyf3WNQWAkQf%n-Vfjzb|MKE!z{%W49~9m%QuHO{wMgxYOaG ztMRi841{HHhHO=aqQ`-HR9r<}Up!D(#H#ISSKn&Zh|C=NsFP~*J9?p0w z6rs2MIP8gCTQ!$g&DWKdSj8>+1JsuSjSO?N*XU%CWn{A(Ctx2&?hV?N8}v*!X*ZGp zY~ePY@~DrJRC0hcEnw{{wAZEl2@0*v(z(xANZ~uoy{%7J{D>=LRwtEB0#{XZS|$qg kgbX4#KSEkbs$m;01ONa4 literal 0 HcmV?d00001 diff --git a/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/ArtTeacher.class b/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/ArtTeacher.class new file mode 100644 index 0000000000000000000000000000000000000000..96f6320d7846d9347f8b35b3b8d9ec9663098a41 GIT binary patch literal 562 zcmZva%}PR15Xb-HM_28ZrrEcpt+YjV*}@7UXeAXW?yq{%BYJOK&kcM7w?Qvri-Lk4 zpa;pfh~}tifpC~%X8!X#bC~n_{q_Oi47nHr2pR~P2xEzmXxk6A)v=wXbyI7Lx*{x{ zN=K@5LNH&bMiD{OK+ME4%zyH7zo$f(Rj$uX>CzY^UF+79jw&lp*xh0Ts|53F@HiR_ zM^Ep3Vn|@kK+;4C>x9&TE`o8d86AhQ`3ZMCAVa0oEEcK;HV9eK@U6bOvxK9h>i@b6 zPgR6nZwb%979q1(HI)!Tmu^E4;w9;bYrk6)Ud66;IFl^7b-PowJ*neqGNf9vM>s4k zrq1s!62eN4L5P)I->Zu&sj2a~{y?HL$N^Ua$o>F7jDJ1= literal 0 HcmV?d00001 diff --git a/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/PETeacher.class b/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/PETeacher.class new file mode 100644 index 0000000000000000000000000000000000000000..4b57d1f6d35d98f6981a30b90bb0efc208f70b1f GIT binary patch literal 559 zcmZvZzfJ-{5XQgZ-@$nTg7_bi4lKOV0<|$(5ha1pAF#rb z9|YdQxO*UKLNi}x=9}NnWeOR z=jr3UjwIGJqzt67PDn4AB51dYVLK9Am~s6DC6qhuQn9XKgOFpbfjJa6CUXQA!yl z7f+W6VWGAl=v8;%HQ6Os(D=e}r2dUOGV&UPO?eun@**;B%gmHYQp1ODpt0ZHkx{jQ tAa-RmW(MpbD>K6WV))pH0kIcosnu5`egW$G3KNC)2NGLAa*b7H*>Wsg^pW&qypLcijK}pMulgaM;@tkv>^PKa(`{%z;e+4j)2Qh>Y z)}ZK65fQj(ZnX;g?$-s=a_jDX`&DsUTU-&)T+^u5%%;HQ)&9_RA5a=V6fq5P9Rtu` z>Nr3PsGehia3;GEM*>3{k~)T^Y4V}*$S5=nYrAlF^PyQKjmTWxs=K!&`7=7sVnjf( zj9pV8wc15j+-BX{F2#u&({T=IfoRpR7Qbm34S|tN57c*D%6=ii7j%r{qCkAxbUOqm zGucxzmb5SHn2>QIrVQdpZ&!4@hAB!%Z)+aMvvk#mWdg73cmo--tQk&i!QNs%)MF*Z zQss2yF)c8*YwVZ{wpBIU2X&Vq%W)0Mbp#eOr|>%&vkwhc!eO!ZDX33iXti#cYpvZ) zv$<|;Hav;#s?pdmnsqr378SQvCyAGJMbJPcf!Y5-bAz>TdTMdyG#^=7XteP4K33_V zDI`MJ$NME{0!m=JUXSZCsVT2BWy=qG%iVd*+xGh|?(g}N!HR2Ccgn_IAdY(P{z`d~ z0aw@=P19*L*u&ATBX!ERi@LT?kNH;YRZ(VNyHext#FL0+$jY$;vQ8@_M9OA@8&xOo4B?r%JLva1esz=^I3Q zII10vyu$hzr(QIU^);TwJArYLp`;iQFS%}BerVOR9`zBOTp~d(0`KCzetvrNd9@#@ zgv^{*bl~T2#?r{Amd||;RXNQ6j?i~d!-x6b5GqgSo?z6Qa&UfanvbF~^9Kgf$}$EYR;iKuvvbN(>K zt6hE!0|jIpSrJvHF6s65LT^FZy+9~QNi!k8R)L$pXs6P;m@LgH^PXJe$x@ACMU(jh zXfsc6^((nPSybdkS_yWdQbKNx_m^hY_ZmnOW&?bH4;fQsOWo!u#B+EZ3*-~#XLgJ- zNok}Ecc2_`L7@ynFm(uVL{N9m k_{z!KfyfT~CC)-D+%n%$?yc~D7oTz_Z0c9@hJOBUy literal 0 HcmV?d00001 diff --git a/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/Teacher.class b/02-Spring-Dependency-Injection-1/target/classes/edu/ytf/entity/entity/Teacher.class new file mode 100644 index 0000000000000000000000000000000000000000..89c03521c6164429e808b4140e702efd39f20528 GIT binary patch literal 139 zcmX^0Z`VEs1_oOOPId++Mh4l`lv4f5k~IC)ypqh4N*EQAnwXrCTEx!4!pI + + 4.0.0 + + stu.example + 03-Spring-Annotate + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + org.springframework + spring-context + 6.1.11 + + + stu.example + 02-Spring-Dependency-Injection-1 + 1.0-SNAPSHOT + compile + + + + \ No newline at end of file diff --git a/03-Spring-Annotate/src/main/java/Main.java b/03-Spring-Annotate/src/main/java/Main.java new file mode 100644 index 0000000..41f6676 --- /dev/null +++ b/03-Spring-Annotate/src/main/java/Main.java @@ -0,0 +1,11 @@ +import edu.ytf.entity.Student; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Main { + public static void main(String[] args) { + ApplicationContext context = new ClassPathXmlApplicationContext("application.xml"); + Student student = (Student) context.getBean("student"); + student.study(); + } +} \ No newline at end of file diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/application.xml b/03-Spring-Annotate/src/main/java/edu/ytf/application.xml new file mode 100644 index 0000000..1a7b640 --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/application.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/config/MainConfiguration.java b/03-Spring-Annotate/src/main/java/edu/ytf/config/MainConfiguration.java new file mode 100644 index 0000000..65adfec --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/config/MainConfiguration.java @@ -0,0 +1,9 @@ +package edu.ytf.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan() +public class MainConfiguration { +} diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/entity/ArtTeacher.java b/03-Spring-Annotate/src/main/java/edu/ytf/entity/ArtTeacher.java new file mode 100644 index 0000000..ef3d358 --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/entity/ArtTeacher.java @@ -0,0 +1,11 @@ +package edu.ytf.entity; + +import org.springframework.stereotype.Component; + +@Component("artTeacher") +public class ArtTeacher implements Teacher { + @Override + public void teach() { + System.out.println("我是美术老师"); + } +} diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/entity/PETeacher.java b/03-Spring-Annotate/src/main/java/edu/ytf/entity/PETeacher.java new file mode 100644 index 0000000..9edbb32 --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/entity/PETeacher.java @@ -0,0 +1,11 @@ +package edu.ytf.entity; + +import org.springframework.stereotype.Component; + +@Component("PETeacher") +public class PETeacher implements Teacher{ + @Override + public void teach(){ + System.out.println("我是体育老师!"); + } +} diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/entity/Student.java b/03-Spring-Annotate/src/main/java/edu/ytf/entity/Student.java new file mode 100644 index 0000000..608303a --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/entity/Student.java @@ -0,0 +1,19 @@ +package edu.ytf.entity; + +public class Student { + + // private Teacher teacher = new PETeacher(); + private Teacher teacher; + private String name; + public void study(){ + teacher.teach(); + } + public Student(Teacher teacher, String name){ + this.teacher = teacher; + this.name = name; + } + // 要使用依赖注入 要提供一个set方法 + // public void setTeacher(Teacher teacher){ + // this.teacher = teacher; + // } +} diff --git a/03-Spring-Annotate/src/main/java/edu/ytf/entity/Teacher.java b/03-Spring-Annotate/src/main/java/edu/ytf/entity/Teacher.java new file mode 100644 index 0000000..9c75a9e --- /dev/null +++ b/03-Spring-Annotate/src/main/java/edu/ytf/entity/Teacher.java @@ -0,0 +1,5 @@ +package edu.ytf.entity; + +public interface Teacher { + void teach(); +} diff --git a/03-Spring-Annotate/target/classes/Main.class b/03-Spring-Annotate/target/classes/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..78c1e39ae3456d7dacce3986b0c2e9ffc71aeac7 GIT binary patch literal 800 zcmb7C+iuf95IvhXapDG2TxtsCQf?(_QI_`r5{<-@3rIl`h^LLSb+`B?dkxKJ@j?Yi zh-W?uF`GoB5)l%%w3j(EbI#1{&tG4^19*ac2NhIpSS{30XIMWG9|Vs?67rYh6B%fR z`eT(S{gk2F>5gnP7!J}rr9O}%Vc1%2Rs=}%7x7kNnj8!KR{axoZ&NB;kHh?uwh)zuQ@4AU|XQKcW){s#N4+dRXX zzwciBg7pf1z&m{S8C%PgE-Z4j;h;f7Y0^xbS^AxM3f#ke!X0`&yLdnZ9?`eand$8k HQo-JDEmpwr literal 0 HcmV?d00001 diff --git a/03-Spring-Annotate/target/classes/edu/ytf/config/MainConfiguration.class b/03-Spring-Annotate/target/classes/edu/ytf/config/MainConfiguration.class new file mode 100644 index 0000000000000000000000000000000000000000..930eaa4f92684deff376c85c5bc2f4c2f5b0e4de GIT binary patch literal 464 zcmb7BO-lnY5PfO4AJ%GX1;LwoQV-_lr7B3l)2d))@98#OQ@fLrW~=@zPl5-3fImu{ zEFy>pF@ZNTZ<2YL$@|Ca8-P=6wopN}fvAld>H^)VS}HkHl*#MSRHt5`eqzY@GlA;< zLDE1|U`LM&`Q#@uwKOrAyi|q;rCT`VjU|C-V8>dZ6C2W3MLyE*R*h!N^kSQ;S)!Z? z@fR8SJF^hji~lOz7ibM_;Zl8JLba`5(np~If$f`uyvcQ97KU}siL5W5#xlpTb(vhu zouO>vRIVSayAQp1{ph9oJ}Q6o#M1w`n9nU~^21b7AG>Jql*1CddCrV09LX{UYKJcn i&rDR%Vhm}ZiB-mS>DSnQJX z6#Rz>3P2S30sIdPzXCDqSTRHtH>24%^WMzOeEY)9={!ZIQsSa&5y5#G3IeGLNmbvE)f>~Q%i^jfhjXgzIMVsZj-6C z>9^K95tazcYNr%KzblmS+7HF1^V>@H_LPfog|Ku6o?wLPmfcZ=Myic^TIOBlwq-Zt zmu6~vGV4gELp*t``aN9`R?;(cQ?(YM=7TUHZrjrJ)Ds=(8q<{fVM^}!Maiw^s-p|d z3Y*4QFTJ*g1vXOa`l1Mf_jjGl)hp{>3jWVdSw9>ov1RjtH9Tw3JCIq)60tm;8Mm;= z`z2iFWe3kYX1mOhU{CC88(%;l$M99Q0Sc{z)?*Ja*euNT+0+eG^Fw8K%FAfAx zg>Lib&3)N&48sqVR_-yw(8_8f#0bIwQH*Pd|4FZRb0;&(G6fY)COsl$_?A`L)t!|h ztBqikpwr_wr|;hX{Pyc}Bjn_6h7m51u3IVQ+7djV}{$8+RyTxH~9*&?5uF69m=k kA2Ifaz@HNVbS2SWBw?SVgn2?sSfI{87sPOnzNH+?7YT)(9{>OV literal 0 HcmV?d00001 diff --git a/03-Spring-Annotate/target/classes/edu/ytf/entity/Student.class b/03-Spring-Annotate/target/classes/edu/ytf/entity/Student.class new file mode 100644 index 0000000000000000000000000000000000000000..6c8067e94ee0f38af759f6fb9aae60917c988f1b GIT binary patch literal 591 zcmZ`$%T59@6g`E3k)be%FMR6`@G)Bx)QyQNq6-L#%Q93bfgu?>CVZBO#OT5g@S}{k z<0K@aY0~@Xx#ymH`}y_$0pJRUIi!%bVR2-TW!RLx$eZa$PX=1)nb*=$k6Z>@OW_Y> z$WUqi!nA*08hNZBXT#yhgD+DhFosM_#gMMnIu43(ZIn1xO-*Sio`g3NLEpRY4y8|x zvzIDR`r7DR<5MoY#g-m~g|V=t?ybr_u1Bno|bt4vRx@SGdLIHpmGwEYwvT6*l! zT(PCKfrDX-q6@N&tW$phdxOpJ9AhdbN3}qXj)QITOpVFzV3#bTZSK)+SRM$OChOK; wQK+BH!Rn`TlowQGSoEByn-g7uq!nYzqo1;bk_ck4rj2X9foK`_DN5ns8*%@1I{*Lx literal 0 HcmV?d00001 diff --git a/03-Spring-Annotate/target/classes/edu/ytf/entity/Teacher.class b/03-Spring-Annotate/target/classes/edu/ytf/entity/Teacher.class new file mode 100644 index 0000000000000000000000000000000000000000..ab3af4d5839cd3b69defb0c7f8a8f4b963b009f8 GIT binary patch literal 132 zcmX^0Z`VEs1_oOOPId++Mh3Celv4f5k~IC)ypqh4O8t=3#N>?BB6bEAMh1bb#Ii*F zoW#6zegCAa)Z`LI2G$agJR<|MhGrNe16OcyytN;K2 literal 0 HcmV?d00001 diff --git a/04-Spring-Annotate/pom.xml b/04-Spring-Annotate/pom.xml new file mode 100644 index 0000000..cbd8fd8 --- /dev/null +++ b/04-Spring-Annotate/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + stu.example + 04-Spring-Annotate + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + org.springframework + spring-context + 6.1.11 + + + org.projectlombok + lombok + 1.18.26 + + + jakarta.annotation + jakarta.annotation-api + 2.1.1 + + + \ No newline at end of file diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/Main.java b/04-Spring-Annotate/src/main/java/edu/ytf/Main.java new file mode 100644 index 0000000..701f22e --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/Main.java @@ -0,0 +1,13 @@ +package edu.ytf; + +import edu.ytf.controller.TestController; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Main { + public static void main(String[] args) { + ApplicationContext context = new ClassPathXmlApplicationContext("application.xml"); + TestController testController = (TestController) context.getBean("testController"); + testController.save(); + } +} diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/controller/TestController.java b/04-Spring-Annotate/src/main/java/edu/ytf/controller/TestController.java new file mode 100644 index 0000000..4ff87a8 --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/controller/TestController.java @@ -0,0 +1,15 @@ +package edu.ytf.controller; + +import edu.ytf.service.TestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; + +@Controller +public class TestController { + @Autowired + private TestService testService; + public void save(){ + testService.save(); + System.out.println("TestController save..."); + } +} diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDao.java b/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDao.java new file mode 100644 index 0000000..9576ed9 --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDao.java @@ -0,0 +1,5 @@ +package edu.ytf.dao; + +public interface TestDao { + void save(); +} diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDaoImpl.java b/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDaoImpl.java new file mode 100644 index 0000000..b3ce3b6 --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/dao/TestDaoImpl.java @@ -0,0 +1,12 @@ +package edu.ytf.dao; + +import org.springframework.stereotype.Repository; + +//Data Access Object +@Repository("testDaoImpl")//用于标记数据访问层的类 +public class TestDaoImpl implements TestDao{ + @Override + public void save() { + System.out.println("TestDaoImpl save ..."); + } +} diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/service/TestService.java b/04-Spring-Annotate/src/main/java/edu/ytf/service/TestService.java new file mode 100644 index 0000000..fd3e7b6 --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/service/TestService.java @@ -0,0 +1,6 @@ +package edu.ytf.service; + +public interface TestService { + void save(); + +} diff --git a/04-Spring-Annotate/src/main/java/edu/ytf/service/TestServiceImpl.java b/04-Spring-Annotate/src/main/java/edu/ytf/service/TestServiceImpl.java new file mode 100644 index 0000000..372dff3 --- /dev/null +++ b/04-Spring-Annotate/src/main/java/edu/ytf/service/TestServiceImpl.java @@ -0,0 +1,16 @@ +package edu.ytf.service; + +import edu.ytf.dao.TestDao; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +@Service("testServiceImpl") +public class TestServiceImpl implements TestService{ + @Resource(name="testDaoImpl") + private TestDao testDao; + @Override + public void save() { + testDao.save(); + System.out.println("TestServiceImpl save ..."); + } +} diff --git a/04-Spring-Annotate/src/main/resources/application.xml b/04-Spring-Annotate/src/main/resources/application.xml new file mode 100644 index 0000000..1700dab --- /dev/null +++ b/04-Spring-Annotate/src/main/resources/application.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/04-Spring-Annotate/target/classes/application.xml b/04-Spring-Annotate/target/classes/application.xml new file mode 100644 index 0000000..1700dab --- /dev/null +++ b/04-Spring-Annotate/target/classes/application.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/04-Spring-Annotate/target/classes/edu/ytf/Main.class b/04-Spring-Annotate/target/classes/edu/ytf/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..39bce818884a09cfd34dc2306ad035cc545e71a4 GIT binary patch literal 844 zcmb7CTTc@~6#k|yY`a}4EK)Cc0TFD$bbYUyNE4qHHGwo5pQg*O4DKznQ^cR;i$qO~ z&;BUmnO&qcHYV;SGnsSw&Ue0Ze*FCM4ZsuZ*r=dtq2^!?^9+k8{FHkUPeSkI=tKmX zVg9j9q<+d!?R1A0>I}Q73cWm2G6|0qkHz~`z4L-J(c(;d`8dl`rM*GK^ZXUp$FJk) zS(ZgI;9921pbV?SW@zz=y>}KzHY_-X$Q6c_jz6KYuT8CfcUVV@VL^*r8yuBJkx)%6 z!L_jL;3`%adjBH#HxULa6na!$&ahFnSWzA)DGvCK&T ze;TAuC~*PS?!291dnp?Exe6(7d4`+%znC1uBme)jqskkXR1C^Y9Vp7)Psb_{&!y?C zVLI=b;bI-Dw0`ERfSCoP^ESOax*6Sb+vi{(3-=v5jT^Khcj0IU%R(7-)xki{em zROts+zruRsHqO!Xcie@~SghbX+ItT_;ray9MXgA;VaC;@X*mV_S_y&s*d)JAE4GCP RRG>{PTj&&gyX2{0`xic<(q8}o literal 0 HcmV?d00001 diff --git a/04-Spring-Annotate/target/classes/edu/ytf/controller/TestController.class b/04-Spring-Annotate/target/classes/edu/ytf/controller/TestController.class new file mode 100644 index 0000000000000000000000000000000000000000..722840dc5307ea4ae94c75a14c1d8061d945e635 GIT binary patch literal 817 zcmaKqU2jrB5Qg6c$|-RAA=qlIwP5`KOxRl!)TF8Lil~u>`{l6U*28YIXAccOOJg*8 z;Scaf8D~$CN>aUnr2yp+6@&~8IZFB5jd^6WvnGzE<)<=nCrg*1;^?3+?My|I;h^^? zCAmDx;uqK53O2D7U^~PO-_8DiVi^jFn8^}qxEWw4#4c{F^xvN+PEM(9lhP}8dfCgA z;cu8D`c}Hywa0y zYrwGgF4ay=>1@IqK5mPt1tMxz$rzzD}n@X-@^=8LB-KiFhEa^8Vtm;NB~$ceEV-KmUu+<-SR6 zBws0ytE~>F|{(3DxTDFSv6>+C)BM al(0dWn|~3j3t|qBDI$j^>ZG3C0)7LElg8oz literal 0 HcmV?d00001 diff --git a/04-Spring-Annotate/target/classes/edu/ytf/dao/TestDao.class b/04-Spring-Annotate/target/classes/edu/ytf/dao/TestDao.class new file mode 100644 index 0000000000000000000000000000000000000000..c09eefe5a95617f2ba7aa2eff077a58c4742d9b3 GIT binary patch literal 128 zcmX^0Z`VEs1_oOOPId++Mh4;3lv4f5k~IC4#C-jb)Z!AC#C&!J7Dfhvti-ZJ{hY+S zbbbG%tkmQZMh2GR#IjUI24)S-Fh&Nh;QZ2}Q; zrIq`}FtfAUE@KYm0AYj*qW|1mqs+;ayi86(EAbel4F74Bb}eV6NSkw5U|7D8nL8Hd zM>e5DYvk(S+Z5;*Sd@xYGURZacs#!&}+Q`N&=J zo-lkORe&|(PBAhRk4#T8EXGR9(>(1+dm%arz0_jU6-irI<@M*sqWh&XhV^&~%lFhI zpl^#IY?<74<%#mF>O?IK-yR{(bL~_r+bUDU|E{%h!YQK(zZV)UV`_>FrfSwL2dpY7GDAWGXWv}k;(+5{0u2zo2&)YsWOlU L!$&%wGJJjnn?98h literal 0 HcmV?d00001 diff --git a/04-Spring-Annotate/target/classes/edu/ytf/service/TestService.class b/04-Spring-Annotate/target/classes/edu/ytf/service/TestService.class new file mode 100644 index 0000000000000000000000000000000000000000..f227f6ad7a32251b3330ff1f99b29d199f1c66a4 GIT binary patch literal 140 zcmX^0Z`VEs1_oOOPId++Mh5BBlv4f5k~IC|)S|M?b=Nb>&Yg45oH@V${QL#r1)i1QAm<|Qp@21pt#dIIJP^^CzaN~-p^x+r-l!(%v-qm<9g8Bb(9RYS>7Wny~s_1ka~Ft~;?$3inyyO+fy zp|e6tcgomA#l@C~ZQFlmMGZqf5mQ;j4t8BsJ>0;}|Csh>iIE`@)G6_;cC$Aq%|FB{ zGCdPZ5q8$G&#-rmUd`gx+U<4;2e|Fx(8C=Z5sMWF^puIk3nFUKnD@wZq6R7&cba_{ zb%uk>2dq$pVgDqJj0$C6C2A1JS5c&mFiJ-W!y#c_h}Z}&mT7(>6P?CG*&z`k5lV*g zLeROq`PX_x$x2s6@?9DZWPB-$Do zu-$9AwXHr3jjoQzJh8Hj&thWtNyitQ{vwvz%qEgAoIr4esR&X_)Uv-~5Y)*~4j5`Q z9BV3ycgdP%iuY*TPw*fsAbZmGAsumwjAEhn9qcnL96X}g9)r*tG+PuZKoc#B%zBGv zd-*s61N_!kxIeJL@CClV_YJrHA#EZ@l^ZCMH@8u_g6J<09XzHA2Tzt + + 4.0.0 + + stu.example + 05-SpringMVC-Quick-Start + 1.0-SNAPSHOT + 05-SpringMVC-Quick-Start + war + + + UTF-8 + 17 + 17 + 5.11.0-M2 + + + + + jakarta.servlet + jakarta.servlet-api + 6.1.0 + provided + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + org.springframework + spring-webmvc + 6.1.6 + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + \ No newline at end of file diff --git a/05-SpringMVC-Quick-Start/src/main/java/stu/example/controller/IndexController.java b/05-SpringMVC-Quick-Start/src/main/java/stu/example/controller/IndexController.java new file mode 100644 index 0000000..836245f --- /dev/null +++ b/05-SpringMVC-Quick-Start/src/main/java/stu/example/controller/IndexController.java @@ -0,0 +1,15 @@ +package stu.example.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class IndexController { + @RequestMapping("/hello") + @ResponseBody + public String hello(){ + System.out.println("Welcome to Spring MVC!"); + return "Welcome to Spring MVC!"; + } +} diff --git a/05-SpringMVC-Quick-Start/src/main/resources/springmvc.xml b/05-SpringMVC-Quick-Start/src/main/resources/springmvc.xml new file mode 100644 index 0000000..a29b5ae --- /dev/null +++ b/05-SpringMVC-Quick-Start/src/main/resources/springmvc.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/05-SpringMVC-Quick-Start/src/main/webapp/WEB-INF/web.xml b/05-SpringMVC-Quick-Start/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..ebf0483 --- /dev/null +++ b/05-SpringMVC-Quick-Start/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + + springmvc + org.springframework.web.server.DispatcherServlet + + contextConfigLocation + classpath:springmvc.xml + + + 1 + + + springmvc + /* + + \ No newline at end of file diff --git a/05-SpringMVC-Quick-Start/src/main/webapp/index.jsp b/05-SpringMVC-Quick-Start/src/main/webapp/index.jsp new file mode 100644 index 0000000..3d6d7b9 --- /dev/null +++ b/05-SpringMVC-Quick-Start/src/main/webapp/index.jsp @@ -0,0 +1,12 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + JSP - Hello World + + +

<%= "Hello World!" %>

+
+Hello Servlet + + \ No newline at end of file diff --git a/05-SpringMVC-Quick-Start/target/classes/springmvc.xml b/05-SpringMVC-Quick-Start/target/classes/springmvc.xml new file mode 100644 index 0000000..a29b5ae --- /dev/null +++ b/05-SpringMVC-Quick-Start/target/classes/springmvc.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/05-SpringMVC-Quick-Start/target/classes/stu/example/controller/IndexController.class b/05-SpringMVC-Quick-Start/target/classes/stu/example/controller/IndexController.class new file mode 100644 index 0000000000000000000000000000000000000000..5068296f9d5657b387a3baf776cd20a788985a79 GIT binary patch literal 820 zcmb7?O>Yx15Qbl;Nj6PVTGF&oK2tub1SEVzpa2p?LPAObHB~rpauSoecV650_|gkyj8*zrrQ}tSZCNu zea7XHh!ZXO*c$Jw*3$83W+IPzCq6^5XD5%RWnF$vsxqL^y%Vg@eMUsRWkm`ZZ89k!R=kj;|gOw&EFQ3@Sj7Zgi&D>Z% zRbeL0KgM?_{2+$gr^0C!oV0$HNd9x+U2I~F)-8MmP@^c5Jx3m=lhIka^%?9#9zIVt zgh30pLAHLJfD5=t9>XPECP*m0pTmIKM?{UKPgrg&y{GE}0wSz;D6U}X7ffxAxk9l9 aWn3j->or(P9bU_8ujlp#LPlugCh!9?-OoY* literal 0 HcmV?d00001 diff --git a/06-SpringBoot-Quick-Start/.gitignore b/06-SpringBoot-Quick-Start/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/06-SpringBoot-Quick-Start/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/06-SpringBoot-Quick-Start/pom.xml b/06-SpringBoot-Quick-Start/pom.xml new file mode 100644 index 0000000..2a1abf5 --- /dev/null +++ b/06-SpringBoot-Quick-Start/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.3.3 + + + edu.ytf + 06-SpringBoot-Quick-Start + 0.0.1-SNAPSHOT + 06-SpringBoot-Quick-Start + 06-SpringBoot-Quick-Start + + + + + + + + + + + + + + + 17 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + true + + + + + + + org.graalvm.buildtools + native-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/Application.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/Application.java new file mode 100644 index 0000000..75efdcb --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/Application.java @@ -0,0 +1,13 @@ +package edu.ytf.springbootquickstart; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/ArrayParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/ArrayParamsController.java new file mode 100644 index 0000000..a4a5985 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/ArrayParamsController.java @@ -0,0 +1,27 @@ +package edu.ytf.springbootquickstart.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@RestController +public class ArrayParamsController { + // 数组参数 + //URL: http://localhost:8080/arrayTest?hobby=LOL&hobby=WUKONG + @RequestMapping(value = "/arrayTest") + public String arrayTest(String[] hobby){ + System.out.println(Arrays.toString(hobby)); + return "Get 请求, hobby=" + Arrays.toString(hobby); + } + + //集合参数 + //URL: http://localhost:8080/listTest?hobby=LOL&hobby=WUKONG + @RequestMapping(value = "/listTest") + public String listTest(@RequestParam List hobby){ + System.out.println(hobby); + return "Get 请求, hobby=" + hobby; + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/DateParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/DateParamsController.java new file mode 100644 index 0000000..745c4d1 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/DateParamsController.java @@ -0,0 +1,20 @@ +package edu.ytf.springbootquickstart.controller; + +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@RestController +public class DateParamsController { + + + @RequestMapping("/dateTest") + //URL: http://localhost:8080/dateTest?dateTime=2024-09-18 16:50:00 + public String dateTest(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")LocalDateTime dateTime){ + System.out.println(dateTime); + return dateTime.toString(); + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/HelloController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/HelloController.java new file mode 100644 index 0000000..b35c27e --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/HelloController.java @@ -0,0 +1,18 @@ +package edu.ytf.springbootquickstart.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + // URL: 协议://ip:端口/路径 + //UR: http://localhost:8080/hello +// @GetMapping("/hello")//通过Get请求访问到方法 + @RequestMapping(value = "/hello",method = RequestMethod.GET) + public String hello(){ + return "你好,SpringBoot!!!"; + + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/JsonParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/JsonParamsController.java new file mode 100644 index 0000000..486b07e --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/JsonParamsController.java @@ -0,0 +1,14 @@ +package edu.ytf.springbootquickstart.controller; + +import edu.ytf.springbootquickstart.pojo.User; +import org.springframework.web.bind.annotation.*; + +@RestController +public class JsonParamsController { + @RequestMapping(value = "/jsonTest1",method = RequestMethod.POST) + public String jsonTest1(@RequestBody User user){ + System.out.println(user); + return "Post 请求, name=" + user.getUsername() + ",password=" +user.getPassword() + + ",province=" +user.getAddress().getProvince() +",city="+user.getAddress().getCity(); + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PathParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PathParamsController.java new file mode 100644 index 0000000..9889d47 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PathParamsController.java @@ -0,0 +1,35 @@ +package edu.ytf.springbootquickstart.controller; + + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class PathParamsController { + @RequestMapping("/pathTest1/{id}") + //URL: http://localhost:8080/pathTest1/1 + public String pathTest1(@PathVariable Integer id){ + return "Path: id="+id; + } + + @RequestMapping("/pathTest2/{id}/{name}") + //URL: http://localhost:8080/pathTest2/1/ytf + public String pathTest2(@PathVariable Integer id,@PathVariable String name){ + return "Path: id="+id +",name="+name; + } + + // ** 任意路径(可以有多级路径) + @RequestMapping("/pathTest3/**") + //URL: http://localhost:8080/pathTest3 + public String pathTest3(){ + return "通配符请求:**"; + } + + // ** 只能有一级路径 + @RequestMapping("/pathTest4/*") + //URL: http://localhost:8080/pathTest4 + public String pathTest4(){ + return "通配符请求:*"; + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PojoParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PojoParamsController.java new file mode 100644 index 0000000..8c44c2a --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/PojoParamsController.java @@ -0,0 +1,27 @@ +package edu.ytf.springbootquickstart.controller; + + +import edu.ytf.springbootquickstart.pojo.User; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class PojoParamsController { + //URL: http://localhost:8080/pojoTest1 + @RequestMapping(value = "/pojoTest1",method = RequestMethod.POST) + public String pojoTest1(User user){ + System.out.println(user); + return "Post 请求, name=" + user.getUsername() + ",password=" +user.getPassword(); + + } + + //URL: http://localhost:8080/pojoTest2 + @RequestMapping(value = "/pojoTest2",method = RequestMethod.POST) + public String pojoTest2(User user){ + System.out.println(user); + return "Post 请求, name=" + user.getUsername() + ",password=" +user.getPassword() + + ",province=" +user.getAddress().getProvince() +",city="+user.getAddress().getCity(); + + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/SimpleParamsController.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/SimpleParamsController.java new file mode 100644 index 0000000..f1463c6 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/controller/SimpleParamsController.java @@ -0,0 +1,48 @@ +package edu.ytf.springbootquickstart.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SimpleParamsController { + //1.Get 无参数 + //URL: http://localhost:8080/getTest1 + @RequestMapping(value = "getTest1",method = RequestMethod.GET) + public String getTest1(){ + return "Get 请求"; + } + + //2. Get 有参数 + //URL: http://localhost:8080/getTest2?nickname=ytf&age=20 + @RequestMapping(value = "/getTest2",method = RequestMethod.GET) + public String getTest2(String nickname,int age){ + System.out.println("Get 请求, name=" +nickname+ ", age=" +age); + return "Get 请求, name=" +nickname+ ", age=" +age ; + } + + //3. Get 有参数 方法的参数与请求的参数不一致 + //URL: http://localhost:8080/getTest3?nickname=ytf&age=20 + @RequestMapping(value = "/getTest3",method = RequestMethod.GET) + public String getTest3(@RequestParam(value = "nickname",required = false) String nickName, int age){ + System.out.println("Get 请求, name=" +nickName+ ", age=" +age); + return "Get 请求, name=" +nickName+ ", age=" +age ; + } + + //4. Post 无参数 + //URL: http://localhost:8080/postTest1 + @RequestMapping(value = "/postTest1",method = RequestMethod.POST) + public String postTest1(){ + return "Post 请求"; + } + + //5. Post 有参数 + //URL: http://localhost:8080/postTest2 + @RequestMapping(value = "/postTest2",method = RequestMethod.POST) + public String postTest2(String nickname, int age){ + System.out.println("Get 请求, name=" +nickname+ ", age=" +age); + return "Get 请求, name=" +nickname+ ", age=" +age ; + } + +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/Address.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/Address.java new file mode 100644 index 0000000..d385bc2 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/Address.java @@ -0,0 +1,11 @@ +package edu.ytf.springbootquickstart.pojo; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Address { + private String province; + private String city; +} diff --git a/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/User.java b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/User.java new file mode 100644 index 0000000..e6aaf4a --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/java/edu/ytf/springbootquickstart/pojo/User.java @@ -0,0 +1,20 @@ +package edu.ytf.springbootquickstart.pojo; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class User { + private String username; + private String password; + private Address address; + + @Override + public String toString() { + return "User{" + + "username='" + username + '\'' + + ", password='" + password + '\'' + + '}'; + } +} diff --git a/06-SpringBoot-Quick-Start/src/main/resources/application.properties b/06-SpringBoot-Quick-Start/src/main/resources/application.properties new file mode 100644 index 0000000..6bb97b8 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/main/resources/application.properties @@ -0,0 +1,7 @@ +spring.application.name=06-SpringBoot-Quick-Start +#????? +spring.devtools.restart.enabled=true +#?????? +spring.devtools.restart.additional-paths=src/main/java +#??cLasspath????WEB-INF??????????(????????? +spring.devtools.restart.exclude=static/** diff --git a/06-SpringBoot-Quick-Start/src/test/java/edu/ytf/springbootquickstart/ApplicationTests.java b/06-SpringBoot-Quick-Start/src/test/java/edu/ytf/springbootquickstart/ApplicationTests.java new file mode 100644 index 0000000..21f9203 --- /dev/null +++ b/06-SpringBoot-Quick-Start/src/test/java/edu/ytf/springbootquickstart/ApplicationTests.java @@ -0,0 +1,13 @@ +package edu.ytf.springbootquickstart; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/JavaEE-2024.iml b/JavaEE-2024.iml new file mode 100644 index 0000000..4ebfb83 --- /dev/null +++ b/JavaEE-2024.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/WEB-INF/web.xml b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/WEB-INF/web.xml new file mode 100644 index 0000000..d80081d --- /dev/null +++ b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/index.jsp b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/index.jsp new file mode 100644 index 0000000..3d6d7b9 --- /dev/null +++ b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/index.jsp @@ -0,0 +1,12 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + JSP - Hello World + + +

<%= "Hello World!" %>

+
+Hello Servlet + + \ No newline at end of file diff --git a/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/web/WEB-INF/web.xml b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/web/WEB-INF/web.xml new file mode 100644 index 0000000..d80081d --- /dev/null +++ b/out/artifacts/05_SpringMVC_Quick_Start_Web_exploded/web/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file