# data **Repository Path**: jasonpj/data ## Basic Information - **Project Name**: data - **Description**: MongoDB简单使用 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-06 - **Last Updated**: 2024-01-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 1、MongoDB的一些简单使用 >参照:https://www.jianshu.com/p/2e3923d90864 >https://www.jianshu.com/p/826d24a5843a # 2、代理简单使用 - jdk动态代理:利用反射机制,基于接口创建被代理对象的代理实例(仅支持基于接口进行代理,无法对类进行代理)代理类通过实现InvocationHander.invok(); - cglib动态代理: 基于继承的方式对代理目标类生成子类,但是不能是final 类型的; 通过实现MethodInterceptor.interceptor(); CGLIB$intercept() 方法实际上是委托给 DynamicAdvisedInterceptor 的 intercept(),这个过程是由CGLIB库通过字节码生成技术(ASM)完成的。 # 3、使用@EnableAspectJAutoProxy 确认使用哪种代理。 - 参数:proxyTargetClass true表示使用cglib代理,false表示使用jdk代理;参数 - 参数:exposeProxy 值为true 表示暴露代理类,目标类中可以嵌套代理类,使用AopContext.currentProxy() 获取代理类