spring.aop 随笔4 如何借助jdk代理类实现aop

0. 下了有一个月的雨,这对鼻炎来说来吗?不好

其实这也算6月份的博客,之前一直疏于整理


  • 本文仅关注jdk代理所实现的spring.aop下,两者的关系
  • 完整的aop源码走读请移步相关 spring.aop 的其他随笔

1. 反编译追踪源码

1.1 jdk代理类

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

import com.weng.cloud.sample.aop.dto.Order;
import com.weng.cloud.sample.aop.service.OrderService;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException;

public final class $Proxy0 extends Proxy implements OrderService, Serializable {
    private static Method m1;
    private static Method m4;
    private static Method m3;
    private static Method m2;
    private static Method m0;

    public $Proxy0(InvocationHandler var1) throws  {
        super(var1);
    }

    public final boolean equals(Object var1) throws  {
        try {
            return (Boolean)super.h.invoke(this, m1, new Object[]{var1});
        } catch (RuntimeException | Error var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

	// 接口实现类
    public final Order queryOrder(String var1) throws  {
        try {
        	// step into super class(invocationHandler) ...
            return (Order)super.h.invoke(this, m4, new Object[]{var1});
        } catch (RuntimeException | Error var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

	// 接口实现类
    public final Order createOrder(String var1, String var2) throws  {
        try {
            return (Order)super.h.invoke(this, m3, new Object[]{var1, var2});
        } catch (RuntimeException | Error var4) {
            throw var4;
        } catch (Throwable var5) {
            throw new UndeclaredThrowableException(var5);
        }
    }

    public final String toString() throws  {
        try {
            return (String)super.h.invoke(this, m2, (Object[])null);
        } catch (RuntimeException | Error var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final int hashCode() throws  {
        try {
            return (Integer)super.h.invoke(this, m0, (Object[])null);
        } catch (RuntimeException | Error var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    static {
        try {
            m1 = Class.forName("java.lang.Object").getMethod("equals", Class.forName("java.lang.Object"));
            m4 = Class.forName("com.weng.cloud.sample.aop.service.OrderService").getMethod("queryOrder", Class.forName("java.lang.String"));
            m3 = Class.forName("com.weng.cloud.sample.aop.service.OrderService").getMethod("createOrder", Class.forName("java.lang.String"), Class.forName("java.lang.String"));
            m2 = Class.forName("java.lang.Object").getMethod("toString");
            m0 = Class.forName("java.lang.Object").getMethod("hashCode");
        } catch (NoSuchMethodException var2) {
            throw new NoSuchMethodError(var2.getMessage());
        } catch (ClassNotFoundException var3) {
            throw new NoClassDefFoundError(var3.getMessage());
        }
    }
}

1.2 java.lang.reflect.InvocationHandler.invoke() spring.aop组装 jdk代理所需的参数

在这里插入图片描述

	/**
	 * Implementation of {@code InvocationHandler.invoke}.
	 * <p>Callers will see exactly the exception thrown by the target,
	 * unless a hook method throws an exception.
	 */
	@Override
	@Nullable
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		Object oldProxy = null;
		boolean setProxyContext = false;

		TargetSource targetSource = this.advised.targetSource;
		Object target = null;

		try {
			if (!this.equalsDefined && AopUtils.isEqualsMethod(method)) {
				// The target does not implement the equals(Object) method itself.
				return equals(args[0]);
			}
			else if (!this.hashCodeDefined && AopUtils.isHashCodeMethod(method)) {
				// The target does not implement the hashCode() method itself.
				return hashCode();
			}
			else if (method.getDeclaringClass() == DecoratingProxy.class) {
				// There is only getDecoratedClass() declared -> dispatch to proxy config.
				return AopProxyUtils.ultimateTargetClass(this.advised);
			}
			else if (!this.advised.opaque && method.getDeclaringClass().isInterface() &&
					method.getDeclaringClass().isAssignableFrom(Advised.class)) {
				// Service invocations on ProxyConfig with the proxy config...
				return AopUtils.invokeJoinpointUsingReflection(this.advised, method, args);
			}

			Object retVal;

			if (this.advised.exposeProxy) {
				// Make invocation available if necessary.
				oldProxy = AopContext.setCurrentProxy(proxy);
				setProxyContext = true;
			}

			// Get as late as possible to minimize the time we "own" the target,
			// in case it comes from a pool.
			target = targetSource.getTarget();
			Class<?> targetClass = (target != null ? target.getClass() : null);

			// 获取增强逻辑的advices
			// Get the interception chain for this method.
			List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);

			// Check whether we have any advice. If we don't, we can fallback on direct
			// reflective invocation of the target, and avoid creating a MethodInvocation.
			if (chain.isEmpty()) {
				// We can skip creating a MethodInvocation: just invoke the target directly
				// Note that the final invoker must be an InvokerInterceptor so we know it does
				// nothing but a reflective operation on the target, and no hot swapping or fancy proxying.
				Object[] argsToUse = AopProxyUtils.adaptArgumentsIfNecessary(method, args);
				retVal = AopUtils.invokeJoinpointUsingReflection(target, method, argsToUse);
			}
			else {
				// proxy:方法外部 Proxy.newInstance() 产出的代理实例
				// target:targetSource中保存的目标实例(在aop调用过程中维护Class实例)
				// method:java.lang.reflect.Method
				// args:方法参数
				// targetClass:target.getClass()
				// chain:增强逻辑advices
				// We need to create a method invocation...
				MethodInvocation invocation =
						new ReflectiveMethodInvocation(proxy, target, method, args, targetClass, chain);
				// step into ...
				// Proceed to the joinpoint through the interceptor chain.
				retVal = invocation.proceed();
			}

			// Massage return value if necessary.
			Class<?> returnType = method.getReturnType();
			if (retVal != null && retVal == target &&
					returnType != Object.class && returnType.isInstance(proxy) &&
					!RawTargetAccess.class.isAssignableFrom(method.getDeclaringClass())) {
				// Special case: it returned "this" and the return type of the method
				// is type-compatible. Note that we can't help if the target sets
				// a reference to itself in another returned object.
				retVal = proxy;
			}
			else if (retVal == null && returnType != Void.TYPE && returnType.isPrimitive()) {
				throw new AopInvocationException(
						"Null return value from advice does not match primitive return type for: " + method);
			}
			return retVal;
		}
		finally {
			if (target != null && !targetSource.isStatic()) {
				// Must have come from TargetSource.
				targetSource.releaseTarget(target);
			}
			if (setProxyContext) {
				// Restore old proxy.
				AopContext.setCurrentProxy(oldProxy);
			}
		}
	}

1.3 spring.aop.MethodInvocation.proceed() 递归调用 advices

在这里插入图片描述

	@Override
	@Nullable
	public Object proceed() throws Throwable {
		// We start with an index of -1 and increment early.
		if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
			return invokeJoinpoint();
		}

		Object interceptorOrInterceptionAdvice =
				this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
		if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) {
			// Evaluate dynamic method matcher here: static part will already have
			// been evaluated and found to match.
			InterceptorAndDynamicMethodMatcher dm =
					(InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice;
			Class<?> targetClass = (this.targetClass != null ? this.targetClass : this.method.getDeclaringClass());
			if (dm.methodMatcher.matches(this.method, targetClass, this.arguments)) {
				return dm.interceptor.invoke(this);
			}
			else {
				// Dynamic matching failed.
				// Skip this interceptor and invoke the next in the chain.
				return proceed();
			}
		}
		else {
			// It's an interceptor, so we just invoke it: The pointcut will have
			// been evaluated statically before this object was constructed.
			return ((MethodInterceptor) interceptorOrInterceptionAdvice).invoke(this);
		}
	}

到这基本结束了,下面内容属于加餐选项

2. cglib代理类反编译源码

其实cglib除了生成代理类的字节码以外,还生成了 Enhancer$EnhancerKey$$KeyFactoryByCGLIB$$xxxx 的字节码。初略的看了一下,果不其然,跟jdk代理一样,使用了 WeakCache 一类的弱缓存技术,只不过是cglib自己实现的。

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.weng.cloud.sample.ctx;

import java.lang.reflect.Method;
import org.springframework.cglib.core.ReflectUtils;
import org.springframework.cglib.core.Signature;
import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Factory;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;
import org.springframework.cglib.proxy.NoOp;

public class SingleService$$EnhancerBySpringCGLIB$$cc775f74 extends SingleService implements Factory {
    private boolean CGLIB$BOUND;
    public static Object CGLIB$FACTORY_DATA;
    private static final ThreadLocal CGLIB$THREAD_CALLBACKS;
    private static final Callback[] CGLIB$STATIC_CALLBACKS;
    private NoOp CGLIB$CALLBACK_0;
    private MethodInterceptor CGLIB$CALLBACK_1;
    private MethodInterceptor CGLIB$CALLBACK_2;
    private static Object CGLIB$CALLBACK_FILTER;
    private static final Method CGLIB$protoService$0$Method;
    private static final MethodProxy CGLIB$protoService$0$Proxy;
    private static final Object[] CGLIB$emptyArgs;

    static void CGLIB$STATICHOOK3() {
        CGLIB$THREAD_CALLBACKS = new ThreadLocal();
        CGLIB$emptyArgs = new Object[0];
        Class var0 = Class.forName("com.weng.cloud.sample.ctx.SingleService$$EnhancerBySpringCGLIB$$cc775f74");
        Class var1;
        CGLIB$protoService$0$Method = ReflectUtils.findMethods(new String[]{"protoService", "()Lcom/weng/cloud/sample/ctx/ProtoService;"}, (var1 = Class.forName("com.weng.cloud.sample.ctx.SingleService")).getDeclaredMethods())[0];
        CGLIB$protoService$0$Proxy = MethodProxy.create(var1, var0, "()Lcom/weng/cloud/sample/ctx/ProtoService;", "protoService", "CGLIB$protoService$0");
    }

    final ProtoService CGLIB$protoService$0() {
        return super.protoService();
    }

	// 被增强的方法
    public final ProtoService protoService() {
        MethodInterceptor var10000 = this.CGLIB$CALLBACK_1;
        if (var10000 == null) {
            CGLIB$BIND_CALLBACKS(this);
            var10000 = this.CGLIB$CALLBACK_1;
        }

		// 调用增强逻辑 methodInterceptor.intercept()
        return var10000 != null ? (ProtoService)var10000.intercept(this, CGLIB$protoService$0$Method, CGLIB$emptyArgs, CGLIB$protoService$0$Proxy) : super.protoService();
    }

    public static MethodProxy CGLIB$findMethodProxy(Signature var0) {
        String var10000 = var0.toString();
        switch(var10000.hashCode()) {
        case 1187820471:
            if (var10000.equals("protoService()Lcom/weng/cloud/sample/ctx/ProtoService;")) {
                return CGLIB$protoService$0$Proxy;
            }
        }

        return null;
    }

	// 构造器
    public SingleService$$EnhancerBySpringCGLIB$$cc775f74() {
    	// 初始化绑定关系(MethodInterceptor)
        CGLIB$BIND_CALLBACKS(this);
    }

    public static void CGLIB$SET_THREAD_CALLBACKS(Callback[] var0) {
        CGLIB$THREAD_CALLBACKS.set(var0);
    }

    public static void CGLIB$SET_STATIC_CALLBACKS(Callback[] var0) {
        CGLIB$STATIC_CALLBACKS = var0;
    }

    private static final void CGLIB$BIND_CALLBACKS(Object var0) {
        SingleService$$EnhancerBySpringCGLIB$$cc775f74 var1 = (SingleService$$EnhancerBySpringCGLIB$$cc775f74)var0;
        if (!var1.CGLIB$BOUND) {
            var1.CGLIB$BOUND = true;
            Object var10000 = CGLIB$THREAD_CALLBACKS.get();
            if (var10000 == null) {
                var10000 = CGLIB$STATIC_CALLBACKS;
                if (var10000 == null) {
                    return;
                }
            }

            Callback[] var10001 = (Callback[])var10000;
            var1.CGLIB$CALLBACK_2 = (MethodInterceptor)((Callback[])var10000)[2];
            var1.CGLIB$CALLBACK_1 = (MethodInterceptor)var10001[1];
            var1.CGLIB$CALLBACK_0 = (NoOp)var10001[0];
        }

    }

    public Object newInstance(Callback[] var1) {
        CGLIB$SET_THREAD_CALLBACKS(var1);
        SingleService$$EnhancerBySpringCGLIB$$cc775f74 var10000 = new SingleService$$EnhancerBySpringCGLIB$$cc775f74();
        CGLIB$SET_THREAD_CALLBACKS((Callback[])null);
        return var10000;
    }

    public Object newInstance(Callback var1) {
        throw new IllegalStateException("More than one callback object required");
    }

    public Object newInstance(Class[] var1, Object[] var2, Callback[] var3) {
        CGLIB$SET_THREAD_CALLBACKS(var3);
        SingleService$$EnhancerBySpringCGLIB$$cc775f74 var10000 = new SingleService$$EnhancerBySpringCGLIB$$cc775f74;
        switch(var1.length) {
        case 0:
            var10000.<init>();
            CGLIB$SET_THREAD_CALLBACKS((Callback[])null);
            return var10000;
        default:
            throw new IllegalArgumentException("Constructor not found");
        }
    }

    public Callback getCallback(int var1) {
        CGLIB$BIND_CALLBACKS(this);
        Object var10000;
        switch(var1) {
        case 0:
            var10000 = this.CGLIB$CALLBACK_0;
            break;
        case 1:
            var10000 = this.CGLIB$CALLBACK_1;
            break;
        case 2:
            var10000 = this.CGLIB$CALLBACK_2;
            break;
        default:
            var10000 = null;
        }

        return (Callback)var10000;
    }

    public void setCallback(int var1, Callback var2) {
        switch(var1) {
        case 0:
            this.CGLIB$CALLBACK_0 = (NoOp)var2;
            break;
        case 1:
            this.CGLIB$CALLBACK_1 = (MethodInterceptor)var2;
            break;
        case 2:
            this.CGLIB$CALLBACK_2 = (MethodInterceptor)var2;
        }

    }

    public Callback[] getCallbacks() {
        CGLIB$BIND_CALLBACKS(this);
        return new Callback[]{this.CGLIB$CALLBACK_0, this.CGLIB$CALLBACK_1, this.CGLIB$CALLBACK_2};
    }

    public void setCallbacks(Callback[] var1) {
        this.CGLIB$CALLBACK_0 = (NoOp)var1[0];
        this.CGLIB$CALLBACK_1 = (MethodInterceptor)var1[1];
        this.CGLIB$CALLBACK_2 = (MethodInterceptor)var1[2];
    }

    static {
        CGLIB$STATICHOOK3();
    }
}

3. JOOR 封装jdk代理

简单带过一下,毕竟这个框架虽然好用,但并不受到广泛关注:

开源(目前在github维护)、轻量级(无第三方依赖)、支持链式调用 的 java反射库

3.1 先来个代理api的测试用例

    @DisplayName("官方MD中的代理用例")
    @Test
    void t1() {
        // 创建String的实例,同时作为 StringProxy的代理实例
        String stringProxy = Reflect.onClass(String.class.getName())
                .create(" hello world ")
                // step into ...
                // jdk代理api
                .as(StringProxy.class)
                .substring(6);
        System.err.println(stringProxy);
    }

3.2 源码

    /**
     * Create a proxy for the wrapped object allowing to typesafely invoke methods
     * on it using a custom interface.
     *
     * @param proxyType The interface type that is implemented by the proxy
     * @return A proxy for the wrapped object
     */
    public <P> P as(Class<P> proxyType) {
    	// step into ...
        return as(proxyType, new Class[0]);
    }

    /**
     * Create a proxy for the wrapped object allowing to typesafely invoke
     * methods on it using a custom interface.
     *
     * @param proxyType The interface type that is implemented by the proxy
     * @param additionalInterfaces Additional interfaces that are implemented by
     *            the proxy
     * @return A proxy for the wrapped object
     */
    @SuppressWarnings("unchecked")
    public <P> P as(final Class<P> proxyType, final Class<?>... additionalInterfaces) {
        final boolean isMap = (object instanceof Map);
        final InvocationHandler handler = new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                String name = method.getName();

                // Actual method name matches always come first
                try {
                    return on(type, object).call(name, args).get();
                }

                // [#14] Emulate POJO behaviour on wrapped map objects
                catch (ReflectException e) {
                    if (isMap) {
                        Map<String, Object> map = (Map<String, Object>) object;
                        int length = (args == null ? 0 : args.length);

                        if (length == 0 && name.startsWith("get")) {
                            return map.get(property(name.substring(3)));
                        }
                        else if (length == 0 && name.startsWith("is")) {
                            return map.get(property(name.substring(2)));
                        }
                        else if (length == 1 && name.startsWith("set")) {
                            map.put(property(name.substring(3)), args[0]);
                            return null;
                        }
                    }


                    if (method.isDefault()) {
                        Lookup proxyLookup = null;

                        // Java 9 version
                        if (CACHED_LOOKUP_CONSTRUCTOR == null) {







                            // Java 9 version for Java 8 distribution (jOOQ Open Source Edition)
                            if (proxyLookup == null)
                                proxyLookup = onClass(MethodHandles.class)
                                    .call("privateLookupIn", proxyType, MethodHandles.lookup())
                                    .call("in", proxyType)
                                    .<Lookup> get();
                        }

                        // Java 8 version
                        else
                            proxyLookup = CACHED_LOOKUP_CONSTRUCTOR.newInstance(proxyType);

                        return proxyLookup.unreflectSpecial(method, proxyType)
                            .bindTo(proxy)
                            .invokeWithArguments(args);
                    }


                    throw e;
                }
            }
        };

        Class<?>[] interfaces = new Class[1 + additionalInterfaces.length];
        interfaces[0] = proxyType;
        System.arraycopy(additionalInterfaces, 0, interfaces, 1, additionalInterfaces.length);
	
		// 原汁原味
        return (P) Proxy.newProxyInstance(proxyType.getClassLoader(), interfaces, handler);
    }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/34328.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Echarts柱状图数据过多设置滚动条效果

未设置前&#xff1a; 可以看出数据全部挤压在一起了 设置后&#xff1a; 下面多出一个滚动条&#xff0c;并且鼠标可以拖动数据 dataZoom: [{show: true,height:8,bottom:0,startValue: 0, //起始值endValue: 5, //结束值showDetail: false,fillerColor: "rgba(1, 132, …

(5)深度学习学习笔记-多层感知机

文章目录 多层感知机和激活函数代码来源 多层感知机和激活函数 通过在网络中加入一个或多个隐藏层来克服线性模型的限制&#xff0c;使其能处理更普遍的函数关系类型。最简单的方法是将多个全连接层堆叠在一起。每一层都输出到上面的层&#xff0c;直到生成最后的输出&#xf…

springboot开启热部署

第一步引入spring-boot-devtools依赖 <!--热部署--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><scope>runtime</scope><!--默认false改依赖是否可以传递&…

虚幻引擎(UE5)-大世界分区WorldPartition教程(三)

文章目录 前言LevelInstance的使用1.ALevelInstance2.选择Actor创建关卡3.运行时加载LevelInstance 总结 上一篇&#xff1a;虚幻引擎(UE5)-大世界分区WorldPartition教程(二) 前言 在制作大关卡时&#xff0c;可能会遇到这样一种情况&#xff0c;就是关卡中的某些Actor会重复…

Element-Plus select选择器-下拉组件错位bug(有高度滚动时)

1. bug重现 由于项目不便展示&#xff0c;因此在官网复现bug https://element-plus.org/zh-CN/component/select.html#基础用法 2. 调试 源码调试时发现下拉菜单是直接放在body 元素里&#xff0c;这时候希望它不要直接放在body里&#xff0c; 查阅文档看到这两个属性&#x…

量化研究丨全市场多空情绪

量化策略开发&#xff0c;高质量社群&#xff0c;交易思路分享等相关内容 大家好&#xff0c;我是Le Chiffre 今天我们简单的介绍一个天风期货工具复现&#xff0c;如下图所示&#xff1a; 其实我只是关注了公众号&#xff0c;但是从来没有认真看过他们的研究。在5月底的时候&…

计算机网络速成

更好的阅读体验 \color{red}{\huge{更好的阅读体验}} 更好的阅读体验 因特网概述 网络、互联网和因特网 网络&#xff1a;将多个计算机或计算机网络通过通信线路连接起来&#xff0c;使得它们可以相互通信和交换信息的系统。由若干节点&#xff08;Node&#xff09;和连接这些…

课程20:API项目重构

🚀前言 本文是《.Net Core从零学习搭建权限管理系统》教程专栏的课程(点击链接,跳转到专栏主页,欢迎订阅,持续更新…) 专栏介绍:以实战为线索,基于.Net 7 + REST + Vue、前后端分离,不依赖任何第三方框架,从零一步一步讲解权限管理系统搭建。 专栏适用于人群:We…

神经网络初谈

文章目录 简介神经网络的发展历程神经网络的初生神经网络的第一次折戟神经网络的新生&#xff0c;Hinton携BP算法登上历史舞台命途多舛&#xff0c;神经网络的第二次寒冬神经网络的重生&#xff0c;黄袍加身&#xff0c;一步封神神经网络的未来&#xff0c;众说纷纭其他时间点 …

Cisco ISR 4000 Series IOS XE Release Dublin-17.11.1a ED

Cisco ISR 4000 Series IOS XE Release Dublin-17.11.1a ED 思科 4000 系列集成服务路由器 请访问原文链接&#xff1a;https://sysin.org/blog/cisco-isr-4000/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org 思科 4000 系列…

计算机视觉:分割一切AI大模型segment-anything

1 segment-anything介绍 Segment Anything Model (SAM)来源于Facebook公司Meta AI实验室。据Mata实验室介绍&#xff0c;SAM 已经学会了关于物体的一般概念&#xff0c;并且它可以为任何图像或视频中的任何物体生成 mask&#xff0c;甚至包括在训练过程中没有遇到过的物体和图…

面对“神奇的甲方”:如何应对匪夷所思的需求

在工作中&#xff0c;我们常常会遇到一些“神奇的甲方”&#xff0c;他们总是能给我们带来匪夷所思甚至无厘头的需求。本文将分享作者的经历&#xff0c;并提供一些建议&#xff0c;帮助读者应对这些“无理的需求”。 文章目录 方向一&#xff1a;分享那些你遇到的无理需求方向…

简单的手机记事本怎么把内容标记为完成状态?

很多人平时会在手机记事本上记录一些自己身边需要记住的事情&#xff0c;有的事情做完之后不想删除&#xff0c;又想要和未完成的内容区分开&#xff0c;那么这种情况下可以将它标记为已完成状态。简单的手机记事本怎么把内容标记为完成状态呢&#xff1f;以iPhone手机端敬业签…

【应用笔记】CW32 电容式触摸按键设计指南

前言 CW32 电容式触摸按键设计指南向客户提供一种利用 CW32 内部资源结合软件编程实现电容式触摸按键有效 触摸检测的方法。本指南的内容重点在于工作原理、软件检测过程以及调试指引。 利用芯源半导体的 CW32 系列小规模 MCU 的 IO、比较器、定时器、高速高精度内置 RC 时钟…

技术分享| 融合通讯的架构介绍

在融合通讯中&#xff0c;我们经常听到如下一些术语&#xff1a;MCU服务&#xff0c;SFU架构&#xff0c;MESH架构&#xff0c;星形网络等等。很多客户听到这些数据都是一脸雾水&#xff0c;经常说我们就是要一个可以把多种设备拉到同一个会议中&#xff0c;怎么搞这么复杂。今…

Web安全-Godzilla(哥斯拉)Webshell管理工具使用

为方便您的阅读&#xff0c;可点击下方蓝色字体&#xff0c;进行跳转↓↓↓ 01 工具下载地址02 运行环境03 工具介绍04 使用案例 01 工具下载地址 https://github.com/BeichenDream/Godzilla点击页面右侧"releases"&#xff0c;进入工具的版本下载页面。 在个人终端…

[Qt 教程之Widgets模块] —— QFontComboBox 字体选择器

Qt系列教程总目录 文章目录 3.2.1 创建 QFontComboBox3.2.2 成员函数1. 书写系统2. 字体过滤器3. 当前字体4. 信号 该控件用于选择字体&#xff0c;在一些软件中经常有类似控件&#xff0c;如下&#xff1a; Microsoft Office&#xff1a; Photoshop&#xff1a; QFontComboB…

QT调用glog日志流程

glog日志库是Google开源的轻量级的日志库&#xff0c;平时在开发过程中经常要使用到日志&#xff0c;本篇记录Qt项目使用glog日志库的记录。 1.首先下载cmake&#xff0c;Download | CMake 安装设置环境变量&#xff0c;检查安装情况 2.下载glog源码 git clone https://git…

JMeter录制HTTPS脚本解决办法

目录 前言&#xff1a; 背景 解决方法 前言&#xff1a; 在使用JMeter录制HTTPS脚本时&#xff0c;可能会遇到一些问题&#xff0c;例如SSL证书错误或请求失败等。解决这些问题的一种常见的方法是通过安装并信任服务器的SSL证书来解决。 背景 在对某项目进行脚本录制的时…

Django框架-5

路由系统 通过URL&#xff08;Uniform Resource Locator&#xff0c;统一资源定位符&#xff09;可以访问互联网上的资源——用户通过 浏览器向指定URL发起请求&#xff0c;Web服务器接收请求并返回用户请求的资源&#xff0c;因此可以将URL视为用户与服务器之间交互的桥梁。 …
最新文章