Java小白学习AOP:注解编程与Spring Boot应用

需积分: 1 0 下载量 119 浏览量 更新于2024-07-09 收藏 3.47MB PPTX 举报
在Java高级编程领域,特别是对于2019年12月06日的课程,"AOP网络编程.pptx"针对初学者讲解了面向接口编程和AOP(Aspect-Oriented Programming,面向切面编程)的概念。这部分内容聚焦于Java 8的新特性,强调了接口编程在现代软件开发中的重要性。 AOP的核心在于将系统的关注点分解为独立的方面(Aspect),如日志记录、事务管理、权限检查等,这些方面可以被模块化地处理,避免了在核心业务逻辑中混杂过多的系统级代码。通过Spring框架,AOP能够实现代码的解耦,提高代码的可维护性和可复用性。 Java注解是Java 1.5版本后引入的重要特性,它允许程序员在源代码中添加元数据,用于传递额外的信息,帮助理解代码意图和简化配置。以下是一些常见的Java注解: 1. `@Override`: 用于标记方法重写,确保子类实现了父类的方法,提高了代码的清晰度和一致性。 2. `@Deprecated`: 提示某个类或方法已过时,引导开发者转向更新的API,有助于维护项目的稳定性。 3. `@SuppressWarnings`: 这个注解用于抑制编译器的特定警告,避免因为某些已知问题而产生的无谓警告,提升编码效率。 在传统的SSM(Spring+MyBatis+Spring MVC)架构中,大量的配置文件是必不可少的,但随着Spring Boot的兴起,这种模式发生了变化。Spring Boot利用Java注解和自动配置(Auto-Configuration)来简化配置,例如`@Autowired`用于自动装配依赖,`@Controller`标注了控制器类,使得开发者无需手动编写大量的XML配置,提高了开发效率和项目的可维护性。 因此,学习AOP和Java注解不仅能提升代码的可读性和灵活性,还能适应现代企业级应用开发的需求,尤其是在简化配置和提高生产力方面。在实际项目中,熟练掌握这些概念和技术将对Java新手小白在职场上取得成功大有裨益。

java.lang.NullPointerException: null at com.datech.web.controller.system.TbappController.remove(TbappController.java:667) at com.datech.web.controller.system.TbappController$$FastClassBySpringCGLIB$$ea1c3ba.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:55) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor$1.proceed(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:82) at org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(AuthorizingMethodInterceptor.java:39) at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor.invoke(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:115) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) at com.datech.web.controller.system.TbappController$$EnhancerBySpringCGLIB$$b3b02033.remove(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2023-07-14 上传
2023-06-03 上传

com.cxm.common.exception.CxmServiceException: 获取日结单数据出错 at com.cxm.service.report.DailyStatManager.reconciliationIndex(DailyStatManager.java:203) at com.cxm.api.report.DailyStatApi.reconciliationIndex(DailyStatApi.java:102) at com.cxm.api.report.DailyStatApi$$FastClassBySpringCGLIB$$4bcc5350.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) at com.cxm.log.CxmLogbackAspect.doAround(CxmLogbackAspect.java:98) at sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)

2023-06-01 上传