diff --git a/spring_all/.idea/codeStyles b/spring_all/.idea/codeStyles new file mode 100644 index 0000000..d37c0a2 --- /dev/null +++ b/spring_all/.idea/codeStyles @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/compiler.xml b/spring_all/.idea/compiler.xml new file mode 100644 index 0000000..6a2b2bf --- /dev/null +++ b/spring_all/.idea/compiler.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/encodings.xml b/spring_all/.idea/encodings.xml new file mode 100644 index 0000000..4987eca --- /dev/null +++ b/spring_all/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__Arquillian_JUnit_Release.xml b/spring_all/.idea/libraries/Maven__Arquillian_JUnit_Release.xml new file mode 100644 index 0000000..a185ae8 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__Arquillian_JUnit_Release.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml b/spring_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml new file mode 100644 index 0000000..e371fe5 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_0.xml b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_0.xml new file mode 100644 index 0000000..d44c789 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml new file mode 100644 index 0000000..8b9b015 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_2_12.xml b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_2_12.xml new file mode 100644 index 0000000..c201fd0 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__com_alibaba_druid_1_2_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_2_6_0.xml b/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_2_6_0.xml new file mode 100644 index 0000000..3cfb78b --- /dev/null +++ b/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_2_6_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml b/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml new file mode 100644 index 0000000..cf24073 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/spring_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml new file mode 100644 index 0000000..9788cac --- /dev/null +++ b/spring_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__junit_junit_4_13_1.xml b/spring_all/.idea/libraries/Maven__junit_junit_4_13_1.xml new file mode 100644 index 0000000..cb993f7 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__junit_junit_4_13_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_11.xml b/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_11.xml new file mode 100644 index 0000000..2a76ddc --- /dev/null +++ b/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml b/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml new file mode 100644 index 0000000..0720d68 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml new file mode 100644 index 0000000..56c9e83 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml new file mode 100644 index 0000000..30141bc --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml new file mode 100644 index 0000000..00e8087 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml b/spring_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml new file mode 100644 index 0000000..9d6be38 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml b/spring_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml new file mode 100644 index 0000000..fd6d05b --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/spring_all/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..75e6014 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml b/spring_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml new file mode 100644 index 0000000..bfe7911 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml b/spring_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml new file mode 100644 index 0000000..bca1aa3 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml b/spring_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml new file mode 100644 index 0000000..7b071a2 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml b/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml new file mode 100644 index 0000000..473a9e9 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_16.xml b/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_16.xml new file mode 100644 index 0000000..1b4bf8f --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_16.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml b/spring_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml new file mode 100644 index 0000000..cc644e5 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml new file mode 100644 index 0000000..9edd474 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml new file mode 100644 index 0000000..34ec857 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml new file mode 100644 index 0000000..d980bff --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml new file mode 100644 index 0000000..b797ce7 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml new file mode 100644 index 0000000..737592c --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml new file mode 100644 index 0000000..b5a337f --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml new file mode 100644 index 0000000..0f96ac2 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml new file mode 100644 index 0000000..1a2dc33 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml new file mode 100644 index 0000000..4a30e09 --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml new file mode 100644 index 0000000..7bd012b --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml b/spring_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml new file mode 100644 index 0000000..f08d01b --- /dev/null +++ b/spring_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/misc.xml b/spring_all/.idea/misc.xml new file mode 100644 index 0000000..7640f46 --- /dev/null +++ b/spring_all/.idea/misc.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/modules.xml b/spring_all/.idea/modules.xml new file mode 100644 index 0000000..0ff93ba --- /dev/null +++ b/spring_all/.idea/modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/spring_all.iml b/spring_all/.idea/spring_all.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/spring_all/.idea/spring_all.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/uiDesigner.xml b/spring_all/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/spring_all/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/.idea/workspace.xml b/spring_all/.idea/workspace.xml new file mode 100644 index 0000000..ccf0947 --- /dev/null +++ b/spring_all/.idea/workspace.xml @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + 1702990948518 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file://$PROJECT_DIR$/spring_ioc_01/src/test/java/Test01.java + 52 + + + file://$PROJECT_DIR$/spring_ioc_02/src/test/java/Test01.java + 30 + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_aop_01/pom.xml b/spring_all/spring_aop_01/pom.xml new file mode 100644 index 0000000..340ca6b --- /dev/null +++ b/spring_all/spring_aop_01/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + org.zhangzeyuan + spring_aop_01 + 1.0-SNAPSHOT + + 5.3.5 + + + + + + + org.springframework + spring-context + 5.3.5 + + + + + org.springframework + spring-aspects + 5.3.5 + + + + + + + aopalliance + aopalliance + 1.0 + + + + commons-logging + commons-logging + 1.2 + + + + + + com.alibaba + druid + 1.2.12 + + + + + + mysql + mysql-connector-java + 8.0.22 + + + + junit + junit + 4.13.1 + test + + + + org.projectlombok + lombok + 1.18.12 + provided + + + + + \ No newline at end of file diff --git a/spring_all/spring_aop_01/spring_aop_01.iml b/spring_all/spring_aop_01/spring_aop_01.iml new file mode 100644 index 0000000..58d02fc --- /dev/null +++ b/spring_all/spring_aop_01/spring_aop_01.iml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspect.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspect.java new file mode 100644 index 0000000..2441273 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspect.java @@ -0,0 +1,55 @@ +package com.zhangzeyuan.aspect; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:46 + * @Version 1.0 + */ +@Component +@Aspect +@Order(1) //Order数字越小,越先代理生成当前对象 +public class DaoAspect { + //定义公共切入点 dao包下面所有的类中的所有add开头的方法都进行增强 + @Pointcut("execution(* com.zhangzeyuan.dao.*.add*(..))") + public void addPointCut(){}; + + /** + * 前置通知 + * Before + * JoinPoint 可以获取方法的参数 + */ + @Before("addPointCut()") + public void methodBefore(JoinPoint joinPoint) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectA前置通知...."); + } + @After("addPointCut()") + public void methodAfter(JoinPoint joinPoint) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectA后置最终通知...."); + } + @AfterReturning(value = "addPointCut()",returning = "res") + public void methodAfterReturning(JoinPoint joinPoint ,Object res) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectA返回值后通知...."); + } + @Around("addPointCut()") + public Object methodAfterReturning(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + System.out.println("DaoAspectA:AroundA invoked"); + Object proceed = proceedingJoinPoint.proceed(); + System.out.println("DaoAspectA:AroundB invoked"); + return proceed; + } + @AfterThrowing(value = "addPointCut()",throwing = "ex") + public void methodAfterThrowing(JoinPoint joinPoint,Exception ex) throws Throwable { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectA抛出异常通知...."); + + } +} diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspectB.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspectB.java new file mode 100644 index 0000000..e5e0154 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/aspect/DaoAspectB.java @@ -0,0 +1,55 @@ +package com.zhangzeyuan.aspect; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:46 + * @Version 1.0 + */ +@Component +@Aspect +@Order(2) //Order数字越小,越先代理生成当前对象 +public class DaoAspectB { + //定义公共切入点 dao包下面所有的类中的所有add开头的方法都进行增强 + @Pointcut("execution(* com.zhangzeyuan.dao.*.add*(..))") + public void addPointCut(){}; + + /** + * 前置通知 + * Before + * JoinPoint 可以获取方法的参数 + */ + @Before("addPointCut()") + public void methodBefore(JoinPoint joinPoint) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectB前置通知...."); + } + @After("addPointCut()") + public void methodAfter(JoinPoint joinPoint) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectB后置最终通知...."); + } + @AfterReturning(value = "addPointCut()",returning = "res") + public void methodAfterReturning(JoinPoint joinPoint,Object res) { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectB返回值后通知...."); + } + @Around(value = "addPointCut()") + public Object methodAfterReturning(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + System.out.println("DaoAspectB:AroundA invoked"); + Object proceed = proceedingJoinPoint.proceed(); + System.out.println("DaoAspectB:AroundB invoked"); + return proceed; + } + @AfterThrowing(value = "addPointCut()",throwing = "ex") + public void methodAfterThrowing(JoinPoint joinPoint,Exception ex) throws Throwable { + String name = joinPoint.getSignature().getName(); + System.out.println(name+":DaoAspectB抛出异常通知...."); + + } +} diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java new file mode 100644 index 0000000..7733539 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java @@ -0,0 +1,13 @@ +package com.zhangzeyuan.dao; + +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:35 + * @Version 1.0 + */ +@Repository +public interface EmpDao { + int addEmp(Integer empno, String ename, String job); +} diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/UserDao.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/UserDao.java new file mode 100644 index 0000000..1395e94 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/UserDao.java @@ -0,0 +1,13 @@ +package com.zhangzeyuan.dao; + +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:35 + * @Version 1.0 + */ +@Repository +public interface UserDao { + int addUser(Integer userId, String username); +} diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java new file mode 100644 index 0000000..831d3ee --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java @@ -0,0 +1,21 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.EmpDao; +import org.springframework.stereotype.Repository; +import org.springframework.stereotype.Service; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:37 + * @Version 1.0 + */ +@Repository +public class EmpDaoImpl implements EmpDao { + @Override + public int addEmp(Integer empno, String ename, String job) { + System.out.println(ename+":addEmp..."); + int a = 1 / 0; + + return 0; + } +} diff --git a/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImpl.java b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImpl.java new file mode 100644 index 0000000..2f068e0 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImpl.java @@ -0,0 +1,18 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.UserDao; +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 16:38 + * @Version 1.0 + */ +@Repository +public class UserDaoImpl implements UserDao { + @Override + public int addUser(Integer userId, String username) { + System.out.println(username+":addUser..."); + return 0; + } +} diff --git a/spring_all/spring_aop_01/src/main/resources/applicationContext.xml b/spring_all/spring_aop_01/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..97e3453 --- /dev/null +++ b/spring_all/spring_aop_01/src/main/resources/applicationContext.xml @@ -0,0 +1,16 @@ + + + \ + + \ No newline at end of file diff --git a/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/aspect/Test1.java b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/aspect/Test1.java new file mode 100644 index 0000000..d103aa7 --- /dev/null +++ b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/aspect/Test1.java @@ -0,0 +1,26 @@ +package com.zhangzeyuan.aspect; + +import com.zhangzeyuan.dao.EmpDao; +import com.zhangzeyuan.dao.UserDao; +import com.zhangzeyuan.dao.impl.UserDaoImpl; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 17:03 + * @Version 1.0 + */ +@Component +public class Test1 { + @Test + public void test1() { + + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + UserDao userDao = context.getBean( UserDao.class); + // int zhangsan = userDao.addUser(1, "zhangsan"); + EmpDao empDao = context.getBean( EmpDao.class); + int i = empDao.addEmp(1 , "aa", "vaitor"); + } +} diff --git a/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/CGLIBProxy.java b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/CGLIBProxy.java new file mode 100644 index 0000000..bdcc0ff --- /dev/null +++ b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/CGLIBProxy.java @@ -0,0 +1,82 @@ +package com.zhangzeyuan.proxy; + +import org.springframework.cglib.proxy.Enhancer; +import org.springframework.cglib.proxy.MethodInterceptor; +import org.springframework.cglib.proxy.MethodProxy; + +import java.lang.reflect.Method; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 22:41 + * @Version 1.0 + */ +public class CGLIBProxy { + public static void main(String[] args) { + //构造的是一个父类对象,new出来的子类在CGLIB上用不上 + PersonB person = new PersonB(); + //创建Enhancer对象 + Enhancer enhancer = new Enhancer(); + //设置父类字节码 + enhancer.setSuperclass(person.getClass()); + //获取methodInterceptor对象 用于定义父类增强规则 + MethodInterceptor methodInterceptor = new MethodInterceptor() { + + @Override + public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { + // o 生成新的子类代理对象 + // method 父类中原本要执行的方法,这是父类的方法 + //方法在调用时,传入的实参, + // methodProxy 子类中重写父类的方法 + Object res; + if (method.getName().equals("eat")) { + //如果是eat 增强并运行 + System.out.println("吃饭之前要洗手"); + res=methodProxy.invokeSuper(o, objects); + System.out.println("吃饭之后要洗手"); + }else { + //用子类执行子类对象 + res=methodProxy.invokeSuper(o, objects);//子类对象方法的执行,默认会调用重写父类的方法 + } + return null; + } + }; + //设置回调方法 + enhancer.setCallback(methodInterceptor); + //反射出来对象 + PersonB personProxy = (PersonB)enhancer.create(); + personProxy.setName("张三"); + personProxy.eat("包子"); + + + } +} +class PersonB{ + private String name; + //无参构造方法,必须要创建,很多反射的细节或者框架的底层需要创建无参构造方法 + public PersonB() { + } + + public void eat(String foodName) { + System.out.println(name+"eat:"+foodName); + + } + @Override + public String toString() { + return "Person{" + + "name='" + name + '\'' + + '}'; + } + + public PersonB(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/DynamicProxy.java b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/DynamicProxy.java new file mode 100644 index 0000000..dccf48b --- /dev/null +++ b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/DynamicProxy.java @@ -0,0 +1,97 @@ +package com.zhangzeyuan.proxy; + +import org.junit.Test; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 21:00 + * @Version 1.0 + */ + +public class DynamicProxy { + public static void main(String[] args) { + Dinner dinner =new PersonA("张三"); + + //ClassLoader loader, 类代理对象的加载器 + ClassLoader classLoader = dinner.getClass().getClassLoader(); + //Class[] interfaces,被代理对象所实现的所有接口 + Class[] interfaces = dinner.getClass().getInterfaces(); + //InvocationHandler h 执行处理器对象,专门定义增强的一个规则 + InvocationHandler invocationHandler = new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + //当代理对象调用任何方法的时候,都会调用当前的方法 + System.out.println("invocation执行了"); + //proxy第一个参数是代理对象,告诉我调用的是哪个对象 dinnerProxy + //method 第二个是要增强的方法 就是当前调用的方法给反射过来 + //args是所有的属性 + Object res =null; + if (method.getName().equals("eat")) { + //代码增强代码:out + System.out.println("饭前要洗手"); + res = method.invoke(dinner, args); + String arg = (String) args[0]; + System.out.println(arg.toString()+"要漱口"); + }else { + res = method.invoke(dinner, args); + } + + return res; + } + }; + Dinner dinnerProxy = (Dinner)Proxy.newProxyInstance(classLoader, interfaces,invocationHandler ); + + dinnerProxy.eat("包子"); + //dinnerProxy.drink(); + } + +} + +interface Dinner{ + void eat(String foodName); + void drink(); +} + +class PersonA implements Dinner { + private String name; + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public void eat(String foodName) { + System.out.println(name+"eat:"+foodName); + + } + + @Override + public void drink() { + System.out.println(name+"drink tea"); + } + + public PersonA(String name) { + this.name = name; + } +} + +class Student implements Dinner { + private String name; + @Override + public void eat(String foodName) { + System.out.println(name+"eat:"+foodName); + } + @Override + public void drink() { + System.out.println(name+"drink juice"); + } +} diff --git a/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/StaticProxyTest.java b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/StaticProxyTest.java new file mode 100644 index 0000000..e8376ac --- /dev/null +++ b/spring_all/spring_aop_01/src/test/java/com/zhangzeyuan/proxy/StaticProxyTest.java @@ -0,0 +1,50 @@ +package com.zhangzeyuan.proxy; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 16:24 + * @Version 1.0 + */ +public class StaticProxyTest { + public static void main(String[] args) { + //创建被代理类 + Person person = new Person("张三"); + //创建代理类,这个类增强了person类,将其功能增强了,并且同样声明了借口,可以代替雇主打官司 + Layer layer = new Layer(person); + //代理类代替原来的类执行增强后的代码 + layer.doCourt(); + } + +} +//接口 +interface Court{ + void doCourt(); +} +//静态代理类 +@Data +@AllArgsConstructor +class Layer implements Court { + private Person person; + @Override + public void doCourt() { + System.out.println("律师取证:张三在旅游,有不在场证据"); + System.out.println("总结:张三没有杀人"); + person.doCourt(); + } + + +} +//功能较弱的类,被代理的类 +@Data +@AllArgsConstructor +@NoArgsConstructor +class Person implements Court{ +private String name; +public void doCourt(){ + System.out.println(name+":我没有杀人"); +} +} \ No newline at end of file diff --git a/spring_all/spring_aop_01/target/classes/applicationContext.xml b/spring_all/spring_aop_01/target/classes/applicationContext.xml new file mode 100644 index 0000000..c858f8d --- /dev/null +++ b/spring_all/spring_aop_01/target/classes/applicationContext.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspect.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspect.class new file mode 100644 index 0000000..4618dd7 Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspect.class differ diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspectB.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspectB.class new file mode 100644 index 0000000..5ed5857 Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/aspect/DaoAspectB.class differ diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/EmpDao.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/EmpDao.class new file mode 100644 index 0000000..7cd7c7c Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/EmpDao.class differ diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/UserDao.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/UserDao.class new file mode 100644 index 0000000..6724ba9 Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/UserDao.class differ diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class new file mode 100644 index 0000000..72f1e56 Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class differ diff --git a/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/UserDaoImpl.class b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/UserDaoImpl.class new file mode 100644 index 0000000..82f7f86 Binary files /dev/null and b/spring_all/spring_aop_01/target/classes/com/zhangzeyuan/dao/impl/UserDaoImpl.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/META-INF/spring_aop_01.kotlin_module b/spring_all/spring_aop_01/target/test-classes/META-INF/spring_aop_01.kotlin_module new file mode 100644 index 0000000..a49347a Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/META-INF/spring_aop_01.kotlin_module differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/aspect/Test1.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/aspect/Test1.class new file mode 100644 index 0000000..9ef125f Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/aspect/Test1.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy$1.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy$1.class new file mode 100644 index 0000000..3fa91ad Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy$1.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy.class new file mode 100644 index 0000000..de13dda Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/CGLIBProxy.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Court.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Court.class new file mode 100644 index 0000000..701dc0e Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Court.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Dinner.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Dinner.class new file mode 100644 index 0000000..232cb97 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Dinner.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy$1.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy$1.class new file mode 100644 index 0000000..324ae25 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy$1.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy.class new file mode 100644 index 0000000..841844e Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/DynamicProxy.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Layer.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Layer.class new file mode 100644 index 0000000..4733946 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Layer.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Person.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Person.class new file mode 100644 index 0000000..bbe6d8c Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Person.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonA.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonA.class new file mode 100644 index 0000000..6680fbe Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonA.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonB.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonB.class new file mode 100644 index 0000000..bd79152 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/PersonB.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/StaticProxyTest.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/StaticProxyTest.class new file mode 100644 index 0000000..c742964 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/StaticProxyTest.class differ diff --git a/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Student.class b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Student.class new file mode 100644 index 0000000..8416945 Binary files /dev/null and b/spring_all/spring_aop_01/target/test-classes/com/zhangzeyuan/proxy/Student.class differ diff --git a/spring_all/spring_ioc_01/pom.xml b/spring_all/spring_ioc_01/pom.xml new file mode 100644 index 0000000..8ad8d80 --- /dev/null +++ b/spring_all/spring_ioc_01/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + org.zhangzeyuan + spring_ioc_01 + 1.0-SNAPSHOT + + + 5.3.5 + + + + + + org.springframework + spring-context + ${spring.version} + + + + junit + junit + 4.13.1 + test + + + org.projectlombok + lombok + 1.18.16 + compile + + + + com.alibaba + druid + 1.1.0 + + + mysql + mysql-connector-java + 8.0.11 + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/spring_ioc_01.iml b/spring_all/spring_ioc_01/spring_ioc_01.iml new file mode 100644 index 0000000..0b68232 --- /dev/null +++ b/spring_all/spring_ioc_01/spring_ioc_01.iml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Book.java b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Book.java new file mode 100644 index 0000000..62f948f --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Book.java @@ -0,0 +1,19 @@ +package com.zhangzeyuan.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 10:44 + * @Version 1.0 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class Book { + private String bookName; + private String author; + +} diff --git a/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Student.java b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Student.java new file mode 100644 index 0000000..a07a6fb --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/Student.java @@ -0,0 +1,27 @@ +package com.zhangzeyuan.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + + + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 10:40 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Student { + private String[] books; + private Set bookSet; + private List bookList; + private Map bookMap; + private List bookList2; +} diff --git a/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/User.java b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/User.java new file mode 100644 index 0000000..463e527 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/bean/User.java @@ -0,0 +1,37 @@ +package com.zhangzeyuan.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author ZZY_1 + * @Date 2023/12/19 21:49 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +public class User { + private Integer userId; + private String username; + private String password; + + public User() { + System.out.println("第一步构造对象"); + } + + public void setUsername(String username) { + this.username = username; + + System.out.println("第二步:set方法"); + } + public void init() { + System.out.println("第三步:初始化方法"); + } + + public void destory() { + System.out.println("第五步骤:对象销毁方法"); + } + + +} diff --git a/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/factory/BookFactory.java b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/factory/BookFactory.java new file mode 100644 index 0000000..12bad49 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/factory/BookFactory.java @@ -0,0 +1,32 @@ +package com.zhangzeyuan.factory; + +import com.zhangzeyuan.bean.Book; +import org.springframework.beans.factory.FactoryBean; + + +/** + * @Author ZZY_1 + * @Date 2023/12/20 10:54 + * @Version 1.0 + */ +public class BookFactory implements FactoryBean { + Book book; + + public void initBook() { + book = new Book(); + book.setBookName("Java"); + book.setAuthor("张三"); + } + + + @Override + public Book getObject() throws Exception { + initBook(); + return book; + } + + @Override + public Class getObjectType() { + return Book.class; + } +} diff --git a/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/process/MyBeanProcess.java b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/process/MyBeanProcess.java new file mode 100644 index 0000000..a2febef --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/java/com/zhangzeyuan/process/MyBeanProcess.java @@ -0,0 +1,23 @@ +package com.zhangzeyuan.process; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 11:54 + * @Version 1.0 + */ +public class MyBeanProcess implements BeanPostProcessor { + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + System.out.println("bean:init对象之前"); + return bean; + } + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + System.out.println("bean:init对象之后"); + return bean; + } +} diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..5ecf526 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext2.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext2.xml new file mode 100644 index 0000000..20ac440 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext2.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + ]]> + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext4.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext4.xml new file mode 100644 index 0000000..3685431 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext4.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext5.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext5.xml new file mode 100644 index 0000000..db30264 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext5.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext6.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext6.xml new file mode 100644 index 0000000..e1a5ded --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext6.xml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/applicationContext7.xml b/spring_all/spring_ioc_01/src/main/resources/applicationContext7.xml new file mode 100644 index 0000000..533f889 --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/applicationContext7.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/main/resources/db.properties b/spring_all/spring_ioc_01/src/main/resources/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_ioc_01/src/main/resources/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_ioc_01/src/test/java/Test01.java b/spring_all/spring_ioc_01/src/test/java/Test01.java new file mode 100644 index 0000000..f6a9c35 --- /dev/null +++ b/spring_all/spring_ioc_01/src/test/java/Test01.java @@ -0,0 +1,59 @@ +import com.alibaba.druid.pool.DruidDataSource; +import com.zhangzeyuan.bean.Book; +import com.zhangzeyuan.bean.Student; +import com.zhangzeyuan.bean.User; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 10:15 + * @Version 1.0 + */ +public class Test01 { + @Test + public void test1() { + ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext2.xml"); + User user1 = context2.getBean("user1", User.class); + System.out.println(user1); + System.exit(0); + } + @Test + public void test2() { + ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext4.xml"); + Student student = context2.getBean("student", Student.class); + System.out.println(student); + System.exit(0); + } + @Test + public void test3() { + ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext5.xml"); + Book book = context2.getBean("bookFactory", Book.class); + System.out.println(book); + System.exit(0); + } + @Test + public void test4() { + + // ApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext6.xml"); + ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext6.xml"); + + User user = context2.getBean("user", User.class); + System.out.println("第四步:对象获取:"+user); + //第五步:执行销毁方法 关闭容器 + context2.close(); + System.exit(0); + } + @Test + public void test5() { + + ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("applicationContext7.xml"); + + DruidDataSource dataSource = context2.getBean("dataSource", DruidDataSource.class); + System.out.println(dataSource); + //关闭容器 + context2.close(); + System.exit(0); + } +} diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext.xml b/spring_all/spring_ioc_01/target/classes/applicationContext.xml new file mode 100644 index 0000000..5ecf526 --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext2.xml b/spring_all/spring_ioc_01/target/classes/applicationContext2.xml new file mode 100644 index 0000000..20ac440 --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext2.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + ]]> + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext4.xml b/spring_all/spring_ioc_01/target/classes/applicationContext4.xml new file mode 100644 index 0000000..3685431 --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext4.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext5.xml b/spring_all/spring_ioc_01/target/classes/applicationContext5.xml new file mode 100644 index 0000000..db30264 --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext5.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext6.xml b/spring_all/spring_ioc_01/target/classes/applicationContext6.xml new file mode 100644 index 0000000..e1a5ded --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext6.xml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/applicationContext7.xml b/spring_all/spring_ioc_01/target/classes/applicationContext7.xml new file mode 100644 index 0000000..fa46c9e --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/applicationContext7.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Book.class b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Book.class new file mode 100644 index 0000000..34926fe Binary files /dev/null and b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Book.class differ diff --git a/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Student.class b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Student.class new file mode 100644 index 0000000..fae1935 Binary files /dev/null and b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/Student.class differ diff --git a/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/User.class b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/User.class new file mode 100644 index 0000000..ac628de Binary files /dev/null and b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/bean/User.class differ diff --git a/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/factory/BookFactory.class b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/factory/BookFactory.class new file mode 100644 index 0000000..07846b7 Binary files /dev/null and b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/factory/BookFactory.class differ diff --git a/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/process/MyBeanProcess.class b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/process/MyBeanProcess.class new file mode 100644 index 0000000..f7936e8 Binary files /dev/null and b/spring_all/spring_ioc_01/target/classes/com/zhangzeyuan/process/MyBeanProcess.class differ diff --git a/spring_all/spring_ioc_01/target/classes/db.properties b/spring_all/spring_ioc_01/target/classes/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_ioc_01/target/classes/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_ioc_01/target/test-classes/Test01.class b/spring_all/spring_ioc_01/target/test-classes/Test01.class new file mode 100644 index 0000000..2a4c1ab Binary files /dev/null and b/spring_all/spring_ioc_01/target/test-classes/Test01.class differ diff --git a/spring_all/spring_ioc_02/pom.xml b/spring_all/spring_ioc_02/pom.xml new file mode 100644 index 0000000..4097513 --- /dev/null +++ b/spring_all/spring_ioc_02/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + org.example + spring_ioc_02 + 1.0-SNAPSHOT + + 5.3.5 + + + + + + org.springframework + spring-context + ${spring.version} + + + + junit + junit + 4.13.1 + test + + + org.projectlombok + lombok + 1.18.16 + compile + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_02/spring_ioc_02.iml b/spring_all/spring_ioc_02/spring_ioc_02.iml new file mode 100644 index 0000000..275de58 --- /dev/null +++ b/spring_all/spring_ioc_02/spring_ioc_02.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/bean/User.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/bean/User.java new file mode 100644 index 0000000..715867a --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/bean/User.java @@ -0,0 +1,28 @@ +package com.zhangzeyuan.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Repository; + +import java.io.Serializable; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:57 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Repository +public class User { + @Value("${sname}") + private String name; + @Value("${sage}") + private Integer age; + @Value("${sgender}") + private String gender; + +} diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/controller/MyController.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/controller/MyController.java new file mode 100644 index 0000000..04cfa52 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/controller/MyController.java @@ -0,0 +1,12 @@ +package com.zhangzeyuan.controller; + +import org.springframework.stereotype.Controller; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:25 + * @Version 1.0 + */ +@Controller +public class MyController { +} diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/UserDao.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/UserDao.java new file mode 100644 index 0000000..ef56c5d --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/UserDao.java @@ -0,0 +1,15 @@ +package com.zhangzeyuan.dao; + +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:39 + * @Version 1.0 + */ +@Repository +public interface UserDao { + public void add(); +} + + diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplA.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplA.java new file mode 100644 index 0000000..87430b7 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplA.java @@ -0,0 +1,17 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.UserDao; +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:40 + * @Version 1.0 + */ +@Repository +public class UserDaoImplA implements UserDao { + @Override + public void add() { + System.out.println("daoImplA add..."); + } +} diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplB.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplB.java new file mode 100644 index 0000000..4eb9bf7 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/dao/impl/UserDaoImplB.java @@ -0,0 +1,17 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.UserDao; +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:40 + * @Version 1.0 + */ +@Repository +public class UserDaoImplB implements UserDao { + @Override + public void add() { + System.out.println("daoImplB add..."); + } +} diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/UserService.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/UserService.java new file mode 100644 index 0000000..aacbacc --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/UserService.java @@ -0,0 +1,13 @@ +package com.zhangzeyuan.service; + +import org.springframework.stereotype.Service; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:42 + * @Version 1.0 + */ +@Service +public interface UserService { + public void add(); +} diff --git a/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..38577d2 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java @@ -0,0 +1,23 @@ +package com.zhangzeyuan.service.impl; + +import com.zhangzeyuan.dao.UserDao; +import com.zhangzeyuan.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:43 + * @Version 1.0 + */ +@Service +public class UserServiceImpl implements UserService { + @Autowired + @Qualifier("userDaoImplA") + UserDao userDao; + @Override + public void add() { + System.out.println("service add..."); + } +} diff --git a/spring_all/spring_ioc_02/src/main/resources/aaa.properties b/spring_all/spring_ioc_02/src/main/resources/aaa.properties new file mode 100644 index 0000000..ecd55a2 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/resources/aaa.properties @@ -0,0 +1,3 @@ +sname=\u5C0F\u767D +sage=19 +sgender=man \ No newline at end of file diff --git a/spring_all/spring_ioc_02/src/main/resources/applicationContext.xml b/spring_all/spring_ioc_02/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..4b35e12 --- /dev/null +++ b/spring_all/spring_ioc_02/src/main/resources/applicationContext.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_02/src/test/java/Test01.java b/spring_all/spring_ioc_02/src/test/java/Test01.java new file mode 100644 index 0000000..7fa0115 --- /dev/null +++ b/spring_all/spring_ioc_02/src/test/java/Test01.java @@ -0,0 +1,37 @@ +import com.zhangzeyuan.bean.User; +import com.zhangzeyuan.controller.MyController; +import com.zhangzeyuan.dao.UserDao; +import com.zhangzeyuan.service.UserService; +import com.zhangzeyuan.service.impl.UserServiceImpl; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/20 15:25 + * @Version 1.0 + */ +@Component +public class Test01 { + @Test + public void test1() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + MyController myController = context.getBean("myController", MyController.class); + System.out.println(myController); + } + @Test + public void test2() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + UserService userService = context.getBean("userServiceImpl", UserServiceImpl.class); + userService.add(); + System.out.println(userService); + } + @Test + public void test3() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + User user = context.getBean("user", User.class); + + System.out.println(user); + } +} diff --git a/spring_all/spring_ioc_02/target/classes/META-INF/spring_ioc_02.kotlin_module b/spring_all/spring_ioc_02/target/classes/META-INF/spring_ioc_02.kotlin_module new file mode 100644 index 0000000..a49347a Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/META-INF/spring_ioc_02.kotlin_module differ diff --git a/spring_all/spring_ioc_02/target/classes/aaa.properties b/spring_all/spring_ioc_02/target/classes/aaa.properties new file mode 100644 index 0000000..ecd55a2 --- /dev/null +++ b/spring_all/spring_ioc_02/target/classes/aaa.properties @@ -0,0 +1,3 @@ +sname=\u5C0F\u767D +sage=19 +sgender=man \ No newline at end of file diff --git a/spring_all/spring_ioc_02/target/classes/applicationContext.xml b/spring_all/spring_ioc_02/target/classes/applicationContext.xml new file mode 100644 index 0000000..4b35e12 --- /dev/null +++ b/spring_all/spring_ioc_02/target/classes/applicationContext.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/bean/User.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/bean/User.class new file mode 100644 index 0000000..f1b0c09 Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/bean/User.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/controller/MyController.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/controller/MyController.class new file mode 100644 index 0000000..1d45fa1 Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/controller/MyController.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/UserDao.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/UserDao.class new file mode 100644 index 0000000..9d31d4b Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/UserDao.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplA.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplA.class new file mode 100644 index 0000000..ff3121e Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplA.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplB.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplB.class new file mode 100644 index 0000000..536eacc Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/dao/impl/UserDaoImplB.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/UserService.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/UserService.class new file mode 100644 index 0000000..90753f9 Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/UserService.class differ diff --git a/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/impl/UserServiceImpl.class b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/impl/UserServiceImpl.class new file mode 100644 index 0000000..3e86de5 Binary files /dev/null and b/spring_all/spring_ioc_02/target/classes/com/zhangzeyuan/service/impl/UserServiceImpl.class differ diff --git a/spring_all/spring_ioc_02/target/test-classes/Test01.class b/spring_all/spring_ioc_02/target/test-classes/Test01.class new file mode 100644 index 0000000..fa11970 Binary files /dev/null and b/spring_all/spring_ioc_02/target/test-classes/Test01.class differ diff --git a/spring_all/spring_jdbctemplate_01/pom.xml b/spring_all/spring_jdbctemplate_01/pom.xml new file mode 100644 index 0000000..8ba72fd --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + org.zhangzeyuan + spring_jdbctemplate_01 + 1.0-SNAPSHOT +jar + + + + org.springframework + spring-context + 5.3.5 + + + + org.springframework + spring-aspects + 5.3.5 + + + + aopalliance + aopalliance + 1.0 + + + + com.alibaba + druid + 1.1.10 + + + + mysql + mysql-connector-java + 8.0.22 + + + + org.springframework + spring-jdbc + 5.3.5 + + + + org.springframework + spring-tx + 5.3.5 + + + + org.springframework + spring-orm + 5.3.5 + + + + commons-logging + commons-logging + 1.2 + + + + junit + junit + 4.13.1 + test + + + + org.projectlombok + lombok + 1.18.12 + provided + + + + \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/spring_jdbctemplate_01.iml b/spring_all/spring_jdbctemplate_01/spring_jdbctemplate_01.iml new file mode 100644 index 0000000..375cb59 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/spring_jdbctemplate_01.iml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/EmpDao.java b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/EmpDao.java new file mode 100644 index 0000000..c6896bb --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/EmpDao.java @@ -0,0 +1,18 @@ +package com.zhangzeyuan; +import com.zhangzeyuan.pojo.Emp; + +import java.util.List; +/** + * @Author ZZY_1 + * @Date 2023/12/21 21:13 + * @Version 1.0 + */ +public interface EmpDao { + int findEmpCount(); + Emp findByEmpno(int empno); + List findByDeptno(int deptno); + int addEmp(Emp emp); + int updateEmp(Emp emp); + int deleteEmp(int empno); + +} diff --git a/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/impl/EmpDaoImpl.java b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/impl/EmpDaoImpl.java new file mode 100644 index 0000000..bc5e3bc --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/impl/EmpDaoImpl.java @@ -0,0 +1,60 @@ +package com.zhangzeyuan.impl; + +import com.zhangzeyuan.EmpDao; +import com.zhangzeyuan.pojo.Emp; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.BeanPropertyRowMapper; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 21:14 + * @Version 1.0 + */ +@Repository +public class EmpDaoImpl implements EmpDao { + @Autowired + JdbcTemplate jdbcTemplate; + @Override + public int findEmpCount() { + Integer integer = jdbcTemplate.queryForObject("select count(*) from emp ", Integer.class); + System.out.println(integer); + return integer; + } + + @Override + public Emp findByEmpno(int empno) { + BeanPropertyRowMapper mapper = new BeanPropertyRowMapper<>(Emp.class); + Emp emp = jdbcTemplate.queryForObject("select * from emp where empno = ? limit 1",mapper, empno); + //System.out.println(emp); + return emp; + } + + @Override + public List findByDeptno(int deptno) { + + BeanPropertyRowMapper mapper = new BeanPropertyRowMapper<>(Emp.class); + List emplist = jdbcTemplate.query("select * from emp where deptno = ? ",mapper, deptno); + + return emplist; + } + + @Override + public int addEmp(Emp emp) { + return 0; + } + + @Override + public int updateEmp(Emp emp) { + return 0; + } + + @Override + public int deleteEmp(int empno) { + return 0; + } +} diff --git a/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/pojo/Emp.java b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/pojo/Emp.java new file mode 100644 index 0000000..d766022 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/pojo/Emp.java @@ -0,0 +1,27 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 21:10 + * @Version 1.0 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Emp implements Serializable { + private Integer empno; + private String ename; + private String job; + private Integer mgr; + private Date hiredate; + private Double sal; + private Double comm; + private Integer deptno; +} \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/EmpService.java b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/EmpService.java new file mode 100644 index 0000000..efaf6a1 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/EmpService.java @@ -0,0 +1,21 @@ +package com.zhangzeyuan.service; + +import com.zhangzeyuan.pojo.Emp; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 21:12 + * @Version 1.0 + */ + +public interface EmpService { + int findEmpCount(); + Emp findByEmpno(int empno); + List findByDeptno(int deptno); + int addEmp(Emp emp); + int updateEmp(Emp emp); + int deleteEmp( int empno); +} diff --git a/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java new file mode 100644 index 0000000..ecb1dfc --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java @@ -0,0 +1,45 @@ +package com.zhangzeyuan.service.impl; + +import com.zhangzeyuan.EmpDao; +import com.zhangzeyuan.pojo.Emp; +import com.zhangzeyuan.service.EmpService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 21:13 + * @Version 1.0 + */ +@Service +public class EmpServiceImpl implements EmpService { + @Autowired + private EmpDao empDao; + @Override + public int findEmpCount() { + return empDao.findEmpCount(); + } + @Override + public Emp findByEmpno(int empno) { + return empDao.findByEmpno( empno); + } + @Override + public List findByDeptno(int deptno) { + return empDao.findByDeptno( deptno); + } + @Override + public int addEmp(Emp emp) { + return empDao.addEmp(emp); + } + @Override + public int updateEmp(Emp emp) { + return empDao.updateEmp(emp); + } + @Override + public int deleteEmp(int empno) { + return empDao.deleteEmp(empno); + } +} + diff --git a/spring_all/spring_jdbctemplate_01/src/main/resources/applicationContext.xml b/spring_all/spring_jdbctemplate_01/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..4ed3847 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/resources/applicationContext.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/src/main/resources/db.properties b/spring_all/spring_jdbctemplate_01/src/main/resources/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/main/resources/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/src/test/java/com/zhangzeyuan/test/Test1.java b/spring_all/spring_jdbctemplate_01/src/test/java/com/zhangzeyuan/test/Test1.java new file mode 100644 index 0000000..a9c9593 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/src/test/java/com/zhangzeyuan/test/Test1.java @@ -0,0 +1,24 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.service.EmpService; +import com.zhangzeyuan.service.impl.EmpServiceImpl; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/21 22:29 + * @Version 1.0 + */ +@Component +public class Test1 { + public static void main(String[] args) { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + EmpService bean = context.getBean("empServiceImpl", EmpServiceImpl.class); + /* int empCount = bean.findEmpCount(); + System.out.println(empCount);*/ + // System.out.println(bean.findByEmpno(7521)); + System.out.println(bean.findByDeptno(20)); + + } +} diff --git a/spring_all/spring_jdbctemplate_01/target/classes/applicationContext.xml b/spring_all/spring_jdbctemplate_01/target/classes/applicationContext.xml new file mode 100644 index 0000000..16e8170 --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/target/classes/applicationContext.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/EmpDao.class b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/EmpDao.class new file mode 100644 index 0000000..551b325 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/EmpDao.class differ diff --git a/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/impl/EmpDaoImpl.class b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/impl/EmpDaoImpl.class new file mode 100644 index 0000000..b8be4f2 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/impl/EmpDaoImpl.class differ diff --git a/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/pojo/Emp.class b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/pojo/Emp.class new file mode 100644 index 0000000..bfd74d9 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/pojo/Emp.class differ diff --git a/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/EmpService.class b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/EmpService.class new file mode 100644 index 0000000..8e69bf6 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/EmpService.class differ diff --git a/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/impl/EmpServiceImpl.class b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/impl/EmpServiceImpl.class new file mode 100644 index 0000000..2964da2 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/classes/com/zhangzeyuan/service/impl/EmpServiceImpl.class differ diff --git a/spring_all/spring_jdbctemplate_01/target/classes/db.properties b/spring_all/spring_jdbctemplate_01/target/classes/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_jdbctemplate_01/target/classes/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_jdbctemplate_01/target/test-classes/com/zhangzeyuan/test/Test1.class b/spring_all/spring_jdbctemplate_01/target/test-classes/com/zhangzeyuan/test/Test1.class new file mode 100644 index 0000000..ba8e009 Binary files /dev/null and b/spring_all/spring_jdbctemplate_01/target/test-classes/com/zhangzeyuan/test/Test1.class differ diff --git a/spring_all/spring_test_01/pom.xml b/spring_all/spring_test_01/pom.xml new file mode 100644 index 0000000..1ad009a --- /dev/null +++ b/spring_all/spring_test_01/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + com.zhangzeyuan + spring_test_01 + 1.0-SNAPSHOT + + 5.3.5 + + + + + + org.springframework + spring-context + ${spring.version} + + + + junit + junit + 4.13.1 + test + + + + + \ No newline at end of file diff --git a/spring_all/spring_test_01/spring_test_01.iml b/spring_all/spring_test_01/spring_test_01.iml new file mode 100644 index 0000000..45483ec --- /dev/null +++ b/spring_all/spring_test_01/spring_test_01.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java new file mode 100644 index 0000000..5b899ce --- /dev/null +++ b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/EmpDao.java @@ -0,0 +1,10 @@ +package com.zhangzeyuan.dao; + +/** + * @Author ZZY_1 + * @Date 2023/12/19 21:19 + * @Version 1.0 + */ +public interface EmpDao { + int addEmp(); +} diff --git a/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java new file mode 100644 index 0000000..ea687a3 --- /dev/null +++ b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl.java @@ -0,0 +1,16 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.EmpDao; + +/** + * @Author ZZY_1 + * @Date 2023/12/19 21:19 + * @Version 1.0 + */ +public class EmpDaoImpl implements EmpDao { + @Override + public int addEmp() { + System.out.println("EmpDaoImpl"); + return 0; + } +} diff --git a/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl2.java b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl2.java new file mode 100644 index 0000000..410ca27 --- /dev/null +++ b/spring_all/spring_test_01/src/main/java/com/zhangzeyuan/dao/impl/EmpDaoImpl2.java @@ -0,0 +1,16 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.EmpDao; + +/** + * @Author ZZY_1 + * @Date 2023/12/19 21:19 + * @Version 1.0 + */ +public class EmpDaoImpl2 implements EmpDao { + @Override + public int addEmp() { + System.out.println("EmpDaoImpl"); + return 0; + } +} diff --git a/spring_all/spring_test_01/src/main/resources/spring.xml b/spring_all/spring_test_01/src/main/resources/spring.xml new file mode 100644 index 0000000..52e631d --- /dev/null +++ b/spring_all/spring_test_01/src/main/resources/spring.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/spring_all/spring_test_01/src/test/java/Test1.java b/spring_all/spring_test_01/src/test/java/Test1.java new file mode 100644 index 0000000..6f8acee --- /dev/null +++ b/spring_all/spring_test_01/src/test/java/Test1.java @@ -0,0 +1,17 @@ +import com.zhangzeyuan.dao.EmpDao; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @Author ZZY_1 + * @Date 2023/12/19 21:20 + * @Version 1.0 + */ +public class Test1 { + @Test + public void test1() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); + EmpDao empDao = context.getBean("empdao", EmpDao.class); + empDao.addEmp(); + } +} diff --git a/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/EmpDao.class b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/EmpDao.class new file mode 100644 index 0000000..8f7e440 Binary files /dev/null and b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/EmpDao.class differ diff --git a/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class new file mode 100644 index 0000000..08de953 Binary files /dev/null and b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl.class differ diff --git a/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl2.class b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl2.class new file mode 100644 index 0000000..be5370f Binary files /dev/null and b/spring_all/spring_test_01/target/classes/com/zhangzeyuan/dao/impl/EmpDaoImpl2.class differ diff --git a/spring_all/spring_test_01/target/classes/spring.xml b/spring_all/spring_test_01/target/classes/spring.xml new file mode 100644 index 0000000..52e631d --- /dev/null +++ b/spring_all/spring_test_01/target/classes/spring.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/spring_all/spring_test_01/target/test-classes/Test1.class b/spring_all/spring_test_01/target/test-classes/Test1.class new file mode 100644 index 0000000..f3f2643 Binary files /dev/null and b/spring_all/spring_test_01/target/test-classes/Test1.class differ diff --git a/spring_all/spring_tx_01/pom.xml b/spring_all/spring_tx_01/pom.xml new file mode 100644 index 0000000..7e2e2ac --- /dev/null +++ b/spring_all/spring_tx_01/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.zhangzeyuan + spring_tx_01 + 1.0-SNAPSHOT + jar + + + + org.springframework + spring-context + 5.3.5 + + + + org.springframework + spring-aspects + 5.3.5 + + + + aopalliance + aopalliance + 1.0 + + + + com.alibaba + druid + 1.1.10 + + + + mysql + mysql-connector-java + 8.0.22 + + + + org.springframework + spring-jdbc + 5.3.5 + + + + org.springframework + spring-tx + 5.3.5 + + + + org.springframework + spring-orm + 5.3.5 + + + + commons-logging + commons-logging + 1.2 + + + + junit + junit + 4.13.1 + test + + + + org.springframework + spring-test + 5.3.5 + test + + + org.junit.jupiter + junit-jupiter-api + 5.7.0 + test + + + + org.projectlombok + lombok + 1.18.12 + provided + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.14.0 + test + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/spring_tx_01.iml b/spring_all/spring_tx_01/spring_tx_01.iml new file mode 100644 index 0000000..558ec49 --- /dev/null +++ b/spring_all/spring_tx_01/spring_tx_01.iml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/AccountDao.java b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/AccountDao.java new file mode 100644 index 0000000..a0e33b6 --- /dev/null +++ b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/AccountDao.java @@ -0,0 +1,10 @@ +package com.zhangzeyuan.dao; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 11:51 + * @Version 1.0 + */ +public interface AccountDao { + int transMoney(int id, Double money); +} diff --git a/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/impl/AccountDaoImpl.java b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/impl/AccountDaoImpl.java new file mode 100644 index 0000000..78758fe --- /dev/null +++ b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/dao/impl/AccountDaoImpl.java @@ -0,0 +1,23 @@ +package com.zhangzeyuan.dao.impl; + +import com.zhangzeyuan.dao.AccountDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 11:52 + * @Version 1.0 + */ +@Repository +public class AccountDaoImpl implements AccountDao { + @Autowired + JdbcTemplate jdbcTemplate; + + @Override + public int transMoney(int id, Double money) { + int update = jdbcTemplate.update("update account set money =money+? where id =?", money, id); + return update; + } +} diff --git a/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/pojo/Account.java b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/pojo/Account.java new file mode 100644 index 0000000..fb8c88f --- /dev/null +++ b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/pojo/Account.java @@ -0,0 +1,22 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 11:48 + * @Version 1.0 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class Account implements Serializable { + private long id; + private String name; + private Double money; + +} diff --git a/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/AccountService.java b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/AccountService.java new file mode 100644 index 0000000..d56fe7a --- /dev/null +++ b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/AccountService.java @@ -0,0 +1,11 @@ +package com.zhangzeyuan.service; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 11:50 + * @Version 1.0 + */ +public interface AccountService { + public int transMoney(int from,int to, Double money); + +} diff --git a/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/impl/AccountServiceImpl.java b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/impl/AccountServiceImpl.java new file mode 100644 index 0000000..d60cafe --- /dev/null +++ b/spring_all/spring_tx_01/src/main/java/com/zhangzeyuan/service/impl/AccountServiceImpl.java @@ -0,0 +1,38 @@ +package com.zhangzeyuan.service.impl; + +import com.zhangzeyuan.dao.AccountDao; +import com.zhangzeyuan.service.AccountService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 11:51 + * @Version 1.0 + */ +@Service +//@Transactional //加在类上,代表类中的所有方法都添加了事务控制 +public class AccountServiceImpl implements AccountService { + @Autowired + AccountDao accountDao; + //Propagation.REQUIRED 事务的传播行为,如果有当前有事务在进行,加入其事务 + //isolation = Isolation.DEFAULT 使用mysql默认的事务隔离级别 + //readOnly = false 默认关闭只读开关 + //timeout =-1 默认值,一直等待运行完了,再提交 + //rollBackFor 指定哪些异常才回滚 + //noRollbackFor 指定通过哪些异常不回滚 + @Override + @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,readOnly = false,noRollbackFor = NullPointerException.class) + public int transMoney(int from,int to, Double money) { + int rows = 0; + //0-money是转出,使用的是负数 + rows += accountDao.transMoney(from, 0.0-money); + //int a = 1 / 0; + rows += accountDao.transMoney(to, money); + return rows; + } +} diff --git a/spring_all/spring_tx_01/src/main/resources/applicationContext.xml b/spring_all/spring_tx_01/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..75757db --- /dev/null +++ b/spring_all/spring_tx_01/src/main/resources/applicationContext.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/src/main/resources/db.properties b/spring_all/spring_tx_01/src/main/resources/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_tx_01/src/main/resources/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_tx_01/src/main/resources/log4j2.xml b/spring_all/spring_tx_01/src/main/resources/log4j2.xml new file mode 100644 index 0000000..7d70412 --- /dev/null +++ b/spring_all/spring_tx_01/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test1.java b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test1.java new file mode 100644 index 0000000..37645da --- /dev/null +++ b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test1.java @@ -0,0 +1,32 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.service.AccountService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.stereotype.Component; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 12:19 + * @Version 1.0 + */ +@Component +/*@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:applicationContext.xml")*/ +public class Test1 { + @Autowired + AccountService accountService; + // @Test + public void test1() { +// ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + //AccountService bean = context.getBean(AccountService.class); + int i = accountService.transMoney(1, 2, 100.0); + System.out.println(i); + } + + +} diff --git a/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test2.java b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test2.java new file mode 100644 index 0000000..53e7ba9 --- /dev/null +++ b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test2.java @@ -0,0 +1,33 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.service.AccountService; + + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 12:19 + * @Version 1.0 + */ +@Component +@ExtendWith(SpringExtension.class) +@ContextConfiguration("classpath:applicationContext.xml") +public class Test2 { + @Autowired + AccountService accountService; + @Test + public void test1() { +// ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + //AccountService bean = context.getBean(AccountService.class); + int i = accountService.transMoney(1, 2, 100.0); + System.out.println(i); + } + + +} diff --git a/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test3.java b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test3.java new file mode 100644 index 0000000..2dbc767 --- /dev/null +++ b/spring_all/spring_tx_01/src/test/java/com/zhangzeyuan/test/Test3.java @@ -0,0 +1,30 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.service.AccountService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 12:19 + * @Version 1.0 + */ +@SpringJUnitConfig(locations = "classpath:applicationContext.xml") +public class Test3 { + @Autowired + AccountService accountService; + @Test + public void test1() { +// ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); + //AccountService bean = context.getBean(AccountService.class); + int i = accountService.transMoney(1, 2, 100.0); + System.out.println(i); + } + + +} diff --git a/spring_all/spring_tx_01/target/classes/applicationContext.xml b/spring_all/spring_tx_01/target/classes/applicationContext.xml new file mode 100644 index 0000000..75757db --- /dev/null +++ b/spring_all/spring_tx_01/target/classes/applicationContext.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/AccountDao.class b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/AccountDao.class new file mode 100644 index 0000000..b25e05d Binary files /dev/null and b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/AccountDao.class differ diff --git a/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/impl/AccountDaoImpl.class b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/impl/AccountDaoImpl.class new file mode 100644 index 0000000..1bbbe79 Binary files /dev/null and b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/dao/impl/AccountDaoImpl.class differ diff --git a/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/pojo/Account.class b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/pojo/Account.class new file mode 100644 index 0000000..7c98bd5 Binary files /dev/null and b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/pojo/Account.class differ diff --git a/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/AccountService.class b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/AccountService.class new file mode 100644 index 0000000..9194873 Binary files /dev/null and b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/AccountService.class differ diff --git a/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/impl/AccountServiceImpl.class b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/impl/AccountServiceImpl.class new file mode 100644 index 0000000..8d3f820 Binary files /dev/null and b/spring_all/spring_tx_01/target/classes/com/zhangzeyuan/service/impl/AccountServiceImpl.class differ diff --git a/spring_all/spring_tx_01/target/classes/db.properties b/spring_all/spring_tx_01/target/classes/db.properties new file mode 100644 index 0000000..c0de7eb --- /dev/null +++ b/spring_all/spring_tx_01/target/classes/db.properties @@ -0,0 +1,4 @@ +jdbc_username=root +jdbc_password=root +jdbc_url=jdbc:mysql://192.168.56.99:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai +jdbc_driver=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/spring_all/spring_tx_01/target/classes/log4j2.xml b/spring_all/spring_tx_01/target/classes/log4j2.xml new file mode 100644 index 0000000..7d70412 --- /dev/null +++ b/spring_all/spring_tx_01/target/classes/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring_all/spring_tx_01/target/test-classes/com/zhangzeyuan/test/Test1.class b/spring_all/spring_tx_01/target/test-classes/com/zhangzeyuan/test/Test1.class new file mode 100644 index 0000000..3a5726c Binary files /dev/null and b/spring_all/spring_tx_01/target/test-classes/com/zhangzeyuan/test/Test1.class differ diff --git a/springmvc_all/.idea/artifacts/springmvc_01_ear_exploded.xml b/springmvc_all/.idea/artifacts/springmvc_01_ear_exploded.xml new file mode 100644 index 0000000..1e6ea03 --- /dev/null +++ b/springmvc_all/.idea/artifacts/springmvc_01_ear_exploded.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/out/artifacts/springmvc_01_ear_exploded + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/artifacts/springmvc_01_war.xml b/springmvc_all/.idea/artifacts/springmvc_01_war.xml new file mode 100644 index 0000000..3949bf8 --- /dev/null +++ b/springmvc_all/.idea/artifacts/springmvc_01_war.xml @@ -0,0 +1,14 @@ + + + $PROJECT_DIR$/springmvc_01/target + + + springmvc_01 + war + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/artifacts/springmvc_01_war_exploded.xml b/springmvc_all/.idea/artifacts/springmvc_01_war_exploded.xml new file mode 100644 index 0000000..fdaf2d8 --- /dev/null +++ b/springmvc_all/.idea/artifacts/springmvc_01_war_exploded.xml @@ -0,0 +1,43 @@ + + + $PROJECT_DIR$/springmvc_01/target/springmvc_01-1.0-SNAPSHOT + + + true + springmvc_01 + war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/artifacts/springmvc_all_war_exploded.xml b/springmvc_all/.idea/artifacts/springmvc_all_war_exploded.xml new file mode 100644 index 0000000..47e881e --- /dev/null +++ b/springmvc_all/.idea/artifacts/springmvc_all_war_exploded.xml @@ -0,0 +1,13 @@ + + + $PROJECT_DIR$/out/artifacts/springmvc_all_war_exploded + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/codeStyles b/springmvc_all/.idea/codeStyles new file mode 100644 index 0000000..d37c0a2 --- /dev/null +++ b/springmvc_all/.idea/codeStyles @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/compiler.xml b/springmvc_all/.idea/compiler.xml new file mode 100644 index 0000000..30a37f9 --- /dev/null +++ b/springmvc_all/.idea/compiler.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/encodings.xml b/springmvc_all/.idea/encodings.xml new file mode 100644 index 0000000..c2bae49 --- /dev/null +++ b/springmvc_all/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml b/springmvc_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml new file mode 100644 index 0000000..e371fe5 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml b/springmvc_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml new file mode 100644 index 0000000..8b9b015 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__com_alibaba_druid_1_1_10.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml b/springmvc_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml new file mode 100644 index 0000000..cf24073 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/springmvc_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml new file mode 100644 index 0000000..9788cac --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__javax_servlet_javax_servlet_api_4_0_1.xml b/springmvc_all/.idea/libraries/Maven__javax_servlet_javax_servlet_api_4_0_1.xml new file mode 100644 index 0000000..f5a2813 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__javax_servlet_javax_servlet_api_4_0_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__javax_servlet_jsp_javax_servlet_jsp_api_2_3_1.xml b/springmvc_all/.idea/libraries/Maven__javax_servlet_jsp_javax_servlet_jsp_api_2_3_1.xml new file mode 100644 index 0000000..673df8c --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__javax_servlet_jsp_javax_servlet_jsp_api_2_3_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml b/springmvc_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml new file mode 100644 index 0000000..0720d68 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml new file mode 100644 index 0000000..56c9e83 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml new file mode 100644 index 0000000..30141bc --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml new file mode 100644 index 0000000..00e8087 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_14_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml b/springmvc_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml new file mode 100644 index 0000000..9d6be38 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml b/springmvc_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml new file mode 100644 index 0000000..fd6d05b --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml b/springmvc_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml new file mode 100644 index 0000000..bfe7911 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml b/springmvc_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml new file mode 100644 index 0000000..bca1aa3 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml b/springmvc_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml new file mode 100644 index 0000000..7b071a2 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml b/springmvc_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml new file mode 100644 index 0000000..473a9e9 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml b/springmvc_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml new file mode 100644 index 0000000..cc644e5 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml new file mode 100644 index 0000000..9edd474 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aop_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml new file mode 100644 index 0000000..34ec857 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_aspects_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml new file mode 100644 index 0000000..d980bff --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_beans_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml new file mode 100644 index 0000000..b797ce7 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_context_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml new file mode 100644 index 0000000..737592c --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_core_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml new file mode 100644 index 0000000..b5a337f --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_expression_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml new file mode 100644 index 0000000..0f96ac2 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml new file mode 100644 index 0000000..1a2dc33 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml new file mode 100644 index 0000000..4a30e09 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_orm_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml new file mode 100644 index 0000000..7bd012b --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_test_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml new file mode 100644 index 0000000..f08d01b --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_tx_5_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_web_5_3_24.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_web_5_3_24.xml new file mode 100644 index 0000000..0ea8c88 --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_web_5_3_24.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_24.xml b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_24.xml new file mode 100644 index 0000000..5d6379f --- /dev/null +++ b/springmvc_all/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_24.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/misc.xml b/springmvc_all/.idea/misc.xml new file mode 100644 index 0000000..5186669 --- /dev/null +++ b/springmvc_all/.idea/misc.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/modules.xml b/springmvc_all/.idea/modules.xml new file mode 100644 index 0000000..d73319f --- /dev/null +++ b/springmvc_all/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/springmvc_all.iml b/springmvc_all/.idea/springmvc_all.iml new file mode 100644 index 0000000..af8c95b --- /dev/null +++ b/springmvc_all/.idea/springmvc_all.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/.idea/workspace.xml b/springmvc_all/.idea/workspace.xml new file mode 100644 index 0000000..e10ebc5 --- /dev/null +++ b/springmvc_all/.idea/workspace.xml @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1703227719784 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/pom.xml b/springmvc_all/springmvc_01/pom.xml new file mode 100644 index 0000000..eb6f43e --- /dev/null +++ b/springmvc_all/springmvc_01/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + org.zhangzeyuan + springmvc_01 + 1.0-SNAPSHOT + war + + + + + org.springframework + spring-context + 5.3.5 + + + + org.springframework + spring-aspects + 5.3.5 + + + + aopalliance + aopalliance + 1.0 + + + + com.alibaba + druid + 1.1.10 + + + + mysql + mysql-connector-java + 8.0.22 + + + + org.springframework + spring-jdbc + 5.3.5 + + + + org.springframework + spring-tx + 5.3.5 + + + + org.springframework + spring-orm + 5.3.5 + + + + commons-logging + commons-logging + 1.2 + + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.14.0 + test + + + + org.projectlombok + lombok + 1.18.12 + provided + + + + org.springframework + spring-test + 5.3.5 + test + + + + org.junit.jupiter + junit-jupiter-api + 5.7.0 + test + + + + org.springframework + spring-web + 5.3.24 + + + org.springframework + spring-webmvc + 5.3.24 + + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.1 + provided + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/springmvc_01.iml b/springmvc_all/springmvc_01/springmvc_01.iml new file mode 100644 index 0000000..6c962a6 --- /dev/null +++ b/springmvc_all/springmvc_01/springmvc_01.iml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/src/main/java/com/zhangzeyuan/controller/FirstController.java b/springmvc_all/springmvc_01/src/main/java/com/zhangzeyuan/controller/FirstController.java new file mode 100644 index 0000000..8d0ef4e --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/java/com/zhangzeyuan/controller/FirstController.java @@ -0,0 +1,19 @@ +package com.zhangzeyuan.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * @Author ZZY_1 + * @Date 2023/12/22 23:35 + * @Version 1.0 + */ +@Controller +public class FirstController { + + @RequestMapping("/mycon.do") + public String to(ModelAndView modelAndView) { + return "first"; + } +} diff --git a/springmvc_all/springmvc_01/src/main/resources/log4j2.xml b/springmvc_all/springmvc_01/src/main/resources/log4j2.xml new file mode 100644 index 0000000..c460f98 --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/src/main/resources/springmvc.xml b/springmvc_all/springmvc_01/src/main/resources/springmvc.xml new file mode 100644 index 0000000..22c8d73 --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/resources/springmvc.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/view/first.jsp b/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/view/first.jsp new file mode 100644 index 0000000..beaebef --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/view/first.jsp @@ -0,0 +1,25 @@ +<%-- + Created by IntelliJ IDEA. + User: ZZY_1 + Date: 2023/12/22 + Time: 23:42 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + + + + + + +This is my first jsp! + + diff --git a/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/web.xml b/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..b01fd61 --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + dispatcherServlet + org.springframework.web.servlet.DispatcherServlet + + + + contextConfigLocation + classpath:springmvc.xml + + 1 + + + + dispatcherServlet + / + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/src/main/webapp/index.jsp b/springmvc_all/springmvc_01/src/main/webapp/index.jsp new file mode 100644 index 0000000..6f087bc --- /dev/null +++ b/springmvc_all/springmvc_01/src/main/webapp/index.jsp @@ -0,0 +1,21 @@ +<%-- + Created by IntelliJ IDEA. + User: ZZY_1 + Date: 2023/12/22 + Time: 19:23 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + $END$ + + + + diff --git a/springmvc_all/springmvc_01/src/main/webapp/static/css/aaa.css b/springmvc_all/springmvc_01/src/main/webapp/static/css/aaa.css new file mode 100644 index 0000000..e69de29 diff --git a/springmvc_all/springmvc_01/src/main/webapp/static/img/aaa.png b/springmvc_all/springmvc_01/src/main/webapp/static/img/aaa.png new file mode 100644 index 0000000..fb1f549 Binary files /dev/null and b/springmvc_all/springmvc_01/src/main/webapp/static/img/aaa.png differ diff --git a/springmvc_all/springmvc_01/src/main/webapp/static/img/帆软初级认证 FCA231200892.jpg b/springmvc_all/springmvc_01/src/main/webapp/static/img/帆软初级认证 FCA231200892.jpg new file mode 100644 index 0000000..87424a7 Binary files /dev/null and b/springmvc_all/springmvc_01/src/main/webapp/static/img/帆软初级认证 FCA231200892.jpg differ diff --git a/springmvc_all/springmvc_01/src/main/webapp/static/js/aaa.js b/springmvc_all/springmvc_01/src/main/webapp/static/js/aaa.js new file mode 100644 index 0000000..e69de29 diff --git a/springmvc_all/springmvc_01/target/classes/com/zhangzeyuan/controller/FirstController.class b/springmvc_all/springmvc_01/target/classes/com/zhangzeyuan/controller/FirstController.class new file mode 100644 index 0000000..0f7aac0 Binary files /dev/null and b/springmvc_all/springmvc_01/target/classes/com/zhangzeyuan/controller/FirstController.class differ diff --git a/springmvc_all/springmvc_01/target/classes/log4j2.xml b/springmvc_all/springmvc_01/target/classes/log4j2.xml new file mode 100644 index 0000000..c460f98 --- /dev/null +++ b/springmvc_all/springmvc_01/target/classes/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/target/classes/springmvc.xml b/springmvc_all/springmvc_01/target/classes/springmvc.xml new file mode 100644 index 0000000..22c8d73 --- /dev/null +++ b/springmvc_all/springmvc_01/target/classes/springmvc.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/target/maven-archiver/pom.properties b/springmvc_all/springmvc_01/target/maven-archiver/pom.properties new file mode 100644 index 0000000..61719be --- /dev/null +++ b/springmvc_all/springmvc_01/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sat Dec 23 00:57:12 CST 2023 +version=1.0-SNAPSHOT +groupId=org.zhangzeyuan +artifactId=springmvc_01 diff --git a/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..1d6b3d8 --- /dev/null +++ b/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +com\zhangzeyuan\controller\FirstController.class diff --git a/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..c71a77d --- /dev/null +++ b/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +D:\ideaWork\springmvc_all\springmvc_01\src\main\java\com\zhangzeyuan\controller\FirstController.java diff --git a/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/springmvc_all/springmvc_01/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT.war b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT.war new file mode 100644 index 0000000..578ac31 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT.war differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/META-INF/MANIFEST.MF b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/META-INF/MANIFEST.MF new file mode 100644 index 0000000..09f7712 --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Created-By: IntelliJ IDEA +Built-By: ZZY_1 +Build-Jdk: version 1.8.0_261 + diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/com/zhangzeyuan/controller/FirstController.class b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/com/zhangzeyuan/controller/FirstController.class new file mode 100644 index 0000000..0f7aac0 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/com/zhangzeyuan/controller/FirstController.class differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/log4j2.xml b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/log4j2.xml new file mode 100644 index 0000000..c460f98 --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/springmvc.xml b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/springmvc.xml new file mode 100644 index 0000000..22c8d73 --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/classes/springmvc.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aopalliance-1.0.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aopalliance-1.0.jar new file mode 100644 index 0000000..578b1a0 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aopalliance-1.0.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aspectjweaver-1.9.6.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aspectjweaver-1.9.6.jar new file mode 100644 index 0000000..61277b6 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/aspectjweaver-1.9.6.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/commons-logging-1.2.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/commons-logging-1.2.jar new file mode 100644 index 0000000..93a3b9f Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/commons-logging-1.2.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/druid-1.1.10.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/druid-1.1.10.jar new file mode 100644 index 0000000..545dfa7 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/druid-1.1.10.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.22.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.22.jar new file mode 100644 index 0000000..412d81f Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.22.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.11.4.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.11.4.jar new file mode 100644 index 0000000..7224d23 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.11.4.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aop-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aop-5.3.5.jar new file mode 100644 index 0000000..95eef9f Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aop-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aspects-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aspects-5.3.5.jar new file mode 100644 index 0000000..d37b8f8 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-aspects-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-beans-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-beans-5.3.5.jar new file mode 100644 index 0000000..cf8e4f9 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-beans-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-context-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-context-5.3.5.jar new file mode 100644 index 0000000..977e2af Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-context-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-core-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-core-5.3.5.jar new file mode 100644 index 0000000..dd287ec Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-core-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-expression-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-expression-5.3.5.jar new file mode 100644 index 0000000..37cf18e Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-expression-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jcl-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jcl-5.3.5.jar new file mode 100644 index 0000000..f9e363d Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jcl-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jdbc-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jdbc-5.3.5.jar new file mode 100644 index 0000000..2b2bcfb Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-jdbc-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-orm-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-orm-5.3.5.jar new file mode 100644 index 0000000..31511e8 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-orm-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-tx-5.3.5.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-tx-5.3.5.jar new file mode 100644 index 0000000..f7a1eee Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-tx-5.3.5.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-web-5.3.24.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-web-5.3.24.jar new file mode 100644 index 0000000..73d55e5 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-web-5.3.24.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-webmvc-5.3.24.jar b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-webmvc-5.3.24.jar new file mode 100644 index 0000000..73b6963 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/lib/spring-webmvc-5.3.24.jar differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/view/first.jsp b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/view/first.jsp new file mode 100644 index 0000000..beaebef --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/view/first.jsp @@ -0,0 +1,25 @@ +<%-- + Created by IntelliJ IDEA. + User: ZZY_1 + Date: 2023/12/22 + Time: 23:42 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + + + + + + +This is my first jsp! + + diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/web.xml b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/web.xml new file mode 100644 index 0000000..b01fd61 --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + dispatcherServlet + org.springframework.web.servlet.DispatcherServlet + + + + contextConfigLocation + classpath:springmvc.xml + + 1 + + + + dispatcherServlet + / + + \ No newline at end of file diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/index.jsp b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/index.jsp new file mode 100644 index 0000000..6f087bc --- /dev/null +++ b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/index.jsp @@ -0,0 +1,21 @@ +<%-- + Created by IntelliJ IDEA. + User: ZZY_1 + Date: 2023/12/22 + Time: 19:23 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + $END$ + + + + diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/css/aaa.css b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/css/aaa.css new file mode 100644 index 0000000..e69de29 diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/aaa.png b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/aaa.png new file mode 100644 index 0000000..fb1f549 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/aaa.png differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/帆软初级认证 FCA231200892.jpg b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/帆软初级认证 FCA231200892.jpg new file mode 100644 index 0000000..87424a7 Binary files /dev/null and b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/img/帆软初级认证 FCA231200892.jpg differ diff --git a/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/js/aaa.js b/springmvc_all/springmvc_01/target/springmvc_01-1.0-SNAPSHOT/static/js/aaa.js new file mode 100644 index 0000000..e69de29