spring 反射,BigDecimal,自定义注解的使用(aop)

news2024/9/20 18:37:39

反射

利用反射调用它类中的属性和方法时,无视修饰符。
获取Class类的对象(三种方式)

  • Class.forName(“全类名”) (推荐使用)
  • 类名.class
  • 对象.getClass()
反射获取构造方法
	Constructor<?>[] getConstructors():返回所有公共构造方法对象的数组
	Constructor<?>[] getDeclaredConstructors():返回所有构造方法对象的数组
	Constructor<T> getConstructor(Class<?>... parameterTypes):返回单个公共构造方法对象
	Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes):返回单个构造方法对象
Constructor类中用于创建对象的方法
	T newInstance(Object... initargs):根据指定的构造方法创建对象
	setAccessible(boolean flag):设置为true,表示取消访问检查,针对访问私有
反射小结
	获取class对象
		三种方式: Class.forName(“全类名”), 类名.class, 对象名.getClass()
	获取里面的构造方法对象
		getConstructor (Class<?>... parameterTypes)
		getDeclaredConstructor (Class<?>... parameterTypes)
	如果是public的,直接创建对象
		newInstance(Object... initargs)
	如果是非public的,需要临时取消检查,然后再创建对象
		setAccessible(boolean) 暴力反射
反射获取成员变量并使用
反射获取Field对象
	Field[] getFields():返回所有公共成员变量对象的数组
	Field[] getDeclaredFields():返回所有成员变量对象的数组
	Field getField(String name):返回单个公共成员变量对象
	Field getDeclaredField(String name):返回单个成员变量对象
获取成员变量并使用
* void set(Object obj,Object value) :给指定对象的成员变量赋值
* Object get(Object obj)返回指定对象的Field的值
反射获取Method对象
	Method[] getMethods(): 返回所有公共成员方法对象的数组,包括继承的
	Method[] getDeclaredMethods(): 返回所有成员方法对象的数组,不包括继承的
	Method getMethod(String name,Class<?>... parameterTypes): 返回单个公共成员方法对象
	Method getDeclaredMethod(String name,Class<?>... parameterTypes): 返回单个成员方法对象
	反射利用Method对象运行方法
	Object invoke(Object obj, Object... args):运行方法
	参数一:用obj对象调用该方法
	参数二:调用方法的传递的参数(如果没有就不写)
	返回值:方法的返回值(如果没有就不写)

新建一个实体类

package com.test.interceptor.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
 * (Student)实体类
 *
 * @author makejava
 * @since 2023-06-17 22:06:09
 */
@Data
public class Student implements Serializable {
    private static final long serialVersionUID = 533250288527593152L;
    private String sId;
    private String sName;
    private String sBirth;
    private String sSex;
    private Student(String name) {
        this.sName = name;
        System.out.println("name的值:"+name);
        System.out.println("private ... Student...有参构造方法");
    }
    public Student() {
        System.out.println("public ... Student... 无参构造方法");
    }
    public Student(String name,int age) {
        this.sName = name;
        this.sBirth = age+"";
        System.out.println("name的值:"+name +"age的值:"+age);
        System.out.println("public ... Student ... 有参构造方法");
    }
}

获取Class对象的三种方式以及通过构造方法创建对象

package com.test.interceptor.testClass;

import com.test.interceptor.domain.Student;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * 获取class对象的三种方式
 */
public class ReflectDemo {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        // Class类中的静态方法forName(“全类名”)  全类名=包名+类名   (推荐使用)
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Student");
//        System.out.println(clazz);

        // 通过class属性来获取
        Class<Student> class2 = Student.class;
//        System.out.println(class2);

        // 通过对象的getClass()方法来获取class对象
//        Student s = new Student();
//        Class<? extends Student> class3 = s.getClass();
//        System.out.println(class3);
        // 获取Constructor对象
        System.out.println("==================");
//        method1();
//        method2();
//        method3();
//        method4();
//        method5();
//        method6();
//        methods7();
    }

    private static void methods7() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
        // 获取一个私有的构造方法并创建对象
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
// 获取一个私有化的构造方法
        Constructor<?> constructor = aClass.getDeclaredConstructor(String.class);
        // 被private修饰的成员,不能直接使用的
        // 如果用反射强行获取并使用,需要临时取消访问检查
        constructor.setAccessible(true);
        // 直接创建对象
        Student student = (Student)constructor.newInstance("张三");
        System.out.println(student);
    }

    private static void method6() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        // 在Class类中,有一个newInstance方法,可以利用空参直接创建一个对象
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        Student student = (Student)aClass.newInstance();
        System.out.println(student);
    }

    private static void method5() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
        // Constructor类中用于创建对象的方法
        //	T newInstance(Object... initargs):根据指定的构造方法创建对象
        //	setAccessible(boolean flag):设置为true,表示取消访问检查
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        // 获取构造方法对象
        Constructor<?> constructor = aClass.getConstructor(String.class, int.class);
        Student student = (Student)constructor.newInstance("张三", 23);
        System.out.println(student);
        Constructor<?> constructor1 = aClass.getConstructor();
        Student stu = (Student) constructor1.newInstance();
        System.out.println(stu);
    }

    private static void method4() throws ClassNotFoundException, NoSuchMethodException {
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        // 返回单个构造方法对象
        Constructor<?> declaredConstructor = aClass.getDeclaredConstructor(String.class);
        System.out.println(declaredConstructor);
    }

    private static void method3() throws ClassNotFoundException, NoSuchMethodException {
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        // 返回单个公共构造方法对象 ()中一定要跟构造方法的形参一致
        Constructor<?> constructor1 = aClass.getConstructor();
        System.out.println(constructor1);
        Constructor<?> constructor2 = aClass.getConstructor(String.class, int.class);
        System.out.println(constructor2);
    }

    private static void method2() throws ClassNotFoundException {
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        // 返回所有构造方法对象的数组
        Constructor<?>[] constructors = aClass.getDeclaredConstructors();
        for (Constructor<?> constructor : constructors) {
            System.out.println(constructor);
        }
    }

    private static void method1() throws ClassNotFoundException {
        Class<?> aClass = Class.forName("com.test.interceptor.domain.Student");
        // 返回所有公共构造方法对象的数组
        Constructor<?>[] constructors = aClass.getConstructors();
        for (Constructor<?> constructor : constructors) {
            System.out.println(constructor);
        }
    }
}

获取成员变量并使用

package com.test.interceptor.testClass;

import com.test.interceptor.domain.Stu;
import com.test.interceptor.domain.Student;

import java.lang.reflect.Field;

public class ReflectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
//        method1();
//        method2();
//        method3();
//        method4();

//        method5();
//        method6();
    }

    private static void method6() throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Field field = clazz.getDeclaredField("address");
        // 取消访问检查,访问私有数据
        field.setAccessible(true);
        Stu student = (Stu)clazz.newInstance();
        Object o = field.get(student);
        System.out.println(o);
    }

    private static void method5() throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        //        获取成员变量并使用
//* void set(Object obj,Object value) :给指定对象的成员变量赋值
//* Object get(Object obj)返回指定对象的Field的值
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Field field = clazz.getField("name");
        // 创建对象
        Stu student = (Stu) clazz.newInstance();
        // 给指定对象赋值
        field.set(student,"wangwu");
        System.out.println(student);
    }
    private static void method4() throws ClassNotFoundException, NoSuchFieldException {
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        //Field getDeclaredField(String name)返回单个成员变量对象
        Field field = clazz.getDeclaredField("address");
        System.out.println(field);
    }

    private static void method3() throws ClassNotFoundException, NoSuchFieldException {
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        // Field getField(String name)  返回单个公共成员变量对象
        // 获取成员变量必须真实存在,public修饰的
        Field name = clazz.getField("name");
        System.out.println(name);
    }
    private static void method2() throws ClassNotFoundException {
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        // 返回所有成员变量对象的数组 Field[] getDeclaredFields()
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            System.out.println(declaredField);
        }
    }
    private static void method1() throws ClassNotFoundException {
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        // 返回所有公共成员变量对象的数组 Field[] getFields()
        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }
}

反射获取对象的方法并使用,运行

package com.test.interceptor.testClass;

import com.test.interceptor.domain.Stu;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ReflectDemo2 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
//反射获取Method对象
//        method1();
//        method2();
//        method3();
//        method4();
//反射利用Method对象运行方法
//	Object invoke(Object obj, Object... args):运行方法
//	参数一:用obj对象调用该方法
//	参数二:调用方法的传递的参数(如果没有就不写)
//	返回值:方法的返回值(如果没有就不写)
        // 获取class对象
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        // 获取里面的method对象
        Method method = clazz.getMethod("function4", String.class);
        // 运行对象
        // 创建Student对象
        Stu student = (Stu)clazz.newInstance();
        Object result = method.invoke(student, "张三");
        System.out.println(result);
    }

    private static void method4() throws ClassNotFoundException, NoSuchMethodException {
        //	Method getDeclaredMethod(String name,Class<?>... parameterTypes): 返回单个成员方法对象
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Method show = clazz.getDeclaredMethod("show");
        System.out.println(show);
        Method method = clazz.getDeclaredMethod("function2", String.class);
        System.out.println(method);
    }

    private static void method3() throws ClassNotFoundException, NoSuchMethodException {
        //	Method getMethod(String name,Class<?>... parameterTypes): 返回单个公共成员方法对象
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Method method = clazz.getMethod("function1");
        System.out.println(method);
        Method function2 = clazz.getMethod("function2", String.class);
        System.out.println(function2);
    }

    private static void method2() throws ClassNotFoundException {
        //	Method[] getDeclaredMethods(): 返回所有成员方法对象的数组,不包括继承的
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Method[] declaredMethods = clazz.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            System.out.println(declaredMethod);
        }
    }

    private static void method1() throws ClassNotFoundException {
        //	Method[] getMethods(): 返回所有公共成员方法对象的数组,包括继承的
        Class<?> clazz = Class.forName("com.test.interceptor.domain.Stu");
        Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
}

BigDecimal的使用(加减乘除)

BigDecimal类的构造方法:
BigDecimal(double val)    参数为double(不推荐使用)
BigDecimalString val)   参数为String(推荐使用)
public BigDecimal divide (另一个BigDecimal对象,精确几位,舍入模式) 	除法
BigDecimal小结
1BigDecimal是用来进行精确计算的
2,创建BigDecimal的对象,构造方法使用参数类型为字符串的。
3,四则运算中的除法,如果除不尽请使用divide的三个参数的方法。
代码示例:
       BigDecimal divide = bd1.divide(参与运算的对象, 小数点后精确到多少位,    舍入模式);
       参数1 ,表示参与运算的BigDecimal 对象。
       参数2 ,表示小数点后面精确到多少位
       参数3 ,舍入模式
	 BigDecimal.ROUND_UP  进一法	BigDecimal.ROUND_FLOOR 去尾法	BigDecimal.ROUND_HALF_UP 四舍五入
package com.test.interceptor.bigdecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class mybigdecimal {
    public static void main(String[] args) {
//        Bigdecimal的初始化时用尽量用String,假如传的是浮点类型,会丢失精度。
        // 如果想使用精确运算,那么请使用字符串的构造
//        method1();
//        methodAdd();
//        methodSubtract();
//        methodMutiply();
//        methodDivide();
//        methodDivicd1();
    }

    private static void methodDivicd1() {
// BigDecimal小结
//1, BigDecimal是用来进行精确计算的
//2,创建BigDecimal的对象,构造方法使用参数类型为字符串的。
//3,四则运算中的除法,如果除不尽请使用divide的三个参数的方法。
//代码示例:
//       BigDecimal divide = bd1.divide(参与运算的对象, 小数点后精确到多少位,    舍入模式);
//       参数1 ,表示参与运算的BigDecimal 对象。
//       参数2 ,表示小数点后面精确到多少位
//       参数3 ,舍入模式
//	 BigDecimal.ROUND_UP  进一法	BigDecimal.ROUND_FLOOR 去尾法	BigDecimal.ROUND_HALF_UP 四舍五入
        BigDecimal bd1 = new BigDecimal("0.3");
        BigDecimal bd2 = new BigDecimal("4");
        BigDecimal divide = bd1.divide(bd2, 2, RoundingMode.HALF_UP);
        System.out.println(divide);
    }

    private static void methodDivide() {
        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.3");
        BigDecimal divide = bd1.divide(bd2, 2, RoundingMode.HALF_UP);
        System.out.println(divide);
    }

    private static void methodMutiply() {
        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.2");
        BigDecimal multiply = bd1.multiply(bd2);
        System.out.println("乘以为" + multiply);
    }

    private static void methodSubtract() {
        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.2");
        BigDecimal subtract = bd1.subtract(bd2);
        System.out.println("差为" + subtract);
    }

    private static void methodAdd() {
        // 如果想使用精确运算,那么请使用字符串的构造
//        BigDecimal bd1 = new BigDecimal(0.1);
//        BigDecimal bd2 = new BigDecimal(0.2);
        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.2");
        BigDecimal add = bd1.add(bd2);
        System.out.println(add);
    }

    // 构造方法
    private static void method1() {
        BigDecimal bigDecimal1 = new BigDecimal(10.0);
        BigDecimal bigDecimal2 = new BigDecimal("0.3");
        System.out.println(bigDecimal1);
        System.out.println(bigDecimal2);
    }
}

自定义注解

格式: 
	public @interface 注解名称 {
        public 属性类型  属性名()default 默认值;
	}
元注解:
**@Target**	指定了注解能在哪里使用(常用)
**@Retention**	可以理解为保留时间(生命周期)(常用)
@Inherited	表示修饰的自定义注解可以被子类继承
**@Documented**	表示该自定义注解,会出现在API文档里面。(常用)

自定义一个注解(练习三)
在这里插入图片描述
自定义一个注解:

package com.test.interceptor.customannotation.testanno2.annotion;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MySysLog {
    String value() default "";
    int age() default 18;
    String[] array() default {};
}

定义一个切面类

package com.test.interceptor.customannotation.testanno2.aspect;
import com.test.interceptor.customannotation.testanno2.annotion.MySysLog;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class SystemLogAspect {
    @Around("@annotation(mySysLog)")
    public Object around(ProceedingJoinPoint point, MySysLog mySysLog) throws Throwable {

//        // 获取执行签名信息
//        Signature signature = point.getSignature();
//        // 通过签名获取执行操作类型(接口名)
//        String className = signature.getDeclaringTypeName();
//        // 通过签名获取执行操作类型(方法名)
//        String methodName = signature.getName();

        System.out.println(mySysLog.age());
        System.out.println(mySysLog.array()[0]);
        // class名称,方法名,参数,返回值,执行时间
        MethodSignature signature = (MethodSignature)point.getSignature();
        // 获取执行目标方法上的注解对象
        MySysLog annotation = signature.getMethod().getAnnotation(MySysLog.class);
        System.out.println(annotation.array()[0]);
        String className = point.getTarget().getClass().getName();
//        String className1 = signature.getDeclaringTypeName();
//        System.out.println(className1);
        String methodName = signature.getName();
        Object[] args = point.getArgs();
        System.out.println(className+","+methodName+","+Arrays.toString(args));
        return point.proceed();
    }
}

controller层

package com.test.interceptor.customannotation.testanno2.controller;
import com.test.interceptor.customannotation.testanno2.service.AnnotationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AnnotationController {
    @Autowired
    private AnnotationService annotationService;

    @RequestMapping("/")
    public String testMyService() {
        annotationService.testMyService();
        return "ok...";
    }
}

service层:

package com.test.interceptor.customannotation.testanno2.service;
public interface AnnotationService {
    public void testMyService();
}

实习类:

package com.test.interceptor.customannotation.testanno2.service.impl;
import com.test.interceptor.customannotation.testanno2.annotion.MySysLog;
import com.test.interceptor.customannotation.testanno2.service.AnnotationService;
import org.springframework.stereotype.Service;
@Service
public class AnnotationServiceImpl implements AnnotationService {
    @Override
    @MySysLog(array = {"1"})
    public void testMyService() {
        System.out.println("对数据库。。。。。。");
    }
}

在启动类上加上开启aop注解

@SpringBootApplication
@EnableAspectJAutoProxy
public class InterceptorApplication {
	public static void main(String[] args) {
		SpringApplication.run(InterceptorApplication.class, args);
	}
}

加入依赖:

<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>1.9.4</version>
		</dependency>

自定义一个注解(练习一)

package com.test.interceptor.customannotation.testanno;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
// 表示Test这个注解的存活时间
@Retention(value = RetentionPolicy.RUNTIME)
public @interface anno {
}
=============================
package com.test.interceptor.customannotation.testanno;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnoDemo {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException {
        // 通过反射获取UseTest类的字节码文件对象
        Class<?> aClass = Class.forName("com.test.interceptor.customannotation.testanno.UseTest");
        // 创建对象
        UseTest useTest = (UseTest) aClass.newInstance();

        // 通过反射获取这个类里面所有的方法对象
        Method[] methods = aClass.getDeclaredMethods();
        // 遍历数组,得到每一个方法对象
        for (Method method : methods) {
            // method表示每一个方法的对象
            // isAnnotationPresent 判断当前方法是否有指定的注解,参数:注解的字节码文件对象,true 存在,false 不存在
            if(method.isAnnotationPresent(anno.class)) {
                method.invoke(useTest);
            }
        }
    }
}
===================================
package com.test.interceptor.customannotation.testanno;

public class UseTest {
    // 没有使用Test注解
    public void show() {
        System.out.println("UserTest... show...");
    }
    // 使用Test注解
    @anno
    public void method() {
        System.out.println("UseTest... method.....");
    }
    @anno
    public void function() {
        System.out.println("UseTest...function.....");
    }
}

练习2

package com.test.interceptor.customannotation.testanno1;
import java.lang.annotation.*;
//@Inherited // 指定该注解可以被继承
@Documented
@Retention(RetentionPolicy.RUNTIME) // 指定了该注解的存活时间
@Target({ElementType.FIELD,ElementType.METHOD,ElementType.TYPE}) // 指定注解使用的位置(成员变量,类,方法上)
public @interface Anno {
}
==================================
package com.test.interceptor.customannotation.testanno1;
@Anno
public class Person {
}
=====================
package com.test.interceptor.customannotation.testanno1;

public class Student extends Person{
    public void show() {
        System.out.println("student...show...");
    }
}
===============
package com.test.interceptor.customannotation.testanno1;

public class StudentDemo {
    public static void main(String[] args) throws ClassNotFoundException {
        // 获取到student类的字节码文件对象
        String className = "com.test.interceptor.customannotation.testanno1.Student";
        Class<?> aClass = Class.forName(className);
        // 获取注解
        boolean result = aClass.isAnnotationPresent(Anno.class);
        System.out.println(result);
    }
}

实现注解的步骤

  1. 声明注解
  2. 添加注解
  3. 获取添加了注解的目标,通常使Class对象,Method对象,Field对象,还有Contructor对象,Parameter对象,Annotation对象等。
  • 通过已知对象,获取Class对象
  • 通过全类路径,获取Class对象
  • 扫描包路径,获取Class对象
  1. 实现注解处理器,借助反射,获取注解对象,读取注解属性值,然后根据注解及属性值做相应处理。
 // value
    public String value();

    // 定义一个基本类型的属性
    int a() default 23;
    // 定义一个String类型的属性
    public String name() default "itheima";
    // 定义一个Class类型的属性
    public Class clazz() default Anno2.class;
    // 定义一个注解类型的属性
    public Anno2 anno() default @Anno2;
    // 定义一个枚举类型的属性
    public Season season() default Season.SPRING;

    // 以上类型的一维数组
    // int 类型  枚举类型
    public int[] arr() default {1,2,3,4,5};
    public Season[] seasons() default {Season.SPRING,Season.SUMMER};

https://www.bilibili.com/read/cv13282317

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Android 逆向之脱壳实战篇

作者&#xff1a;37手游安卓团队 前言 这篇文章比较干&#xff0c;比较偏实战&#xff0c;看之前建议先喝足水&#xff0c;慎入。 在学脱壳之前&#xff0c;我们先来复习一下&#xff0c;什么时候是加固&#xff1f; 加固本质上就是对 dex 文件进行加壳处理&#xff0c;让一些…

信号三大阶段之储存信号

目录 一、 信号三大阶段 二、信号储存相关概念 三、 理解概念 四、信号储存原理 五、信号集操作函数 一、 信号三大阶段 二、信号储存相关概念 实际执行信号的过程被称为信号递达&#xff08;Delivery&#xff09;。信号从产生到递达之间的状态被称为信号未决&#xff08;…

【Linux】初步认识Linux系统

Linux 操作系统 主要作用是管理好硬件设备&#xff0c;并为用户和应用程序提供一个简单的接口&#xff0c;以便于使用。 作为中间人&#xff0c;连接硬件和软件 常见操作系统 桌面操作系统 WindowsmacOsLinux 服务器操作系统 LinuxWindows Server 嵌入式操作系统 Linux …

从零搭建一台基于ROS的自动驾驶车-----1.整体介绍

系列文章目录 北科天绘 16线3维激光雷达开发教程 基于Rplidar二维雷达使用Hector_SLAM算法在ROS中建图 Nvidia Jetson Nano学习笔记–串口通信 Nvidia Jetson Nano学习笔记–使用C语言实现GPIO 输入输出 Autolabor ROS机器人教程 文章目录 系列文章目录前言一、小车底盘二、激…

Redis入门(三)

第5章 Redis的相关配置(redis.conf) 1&#xff09;计量单位说明,大小写不敏感 # 1k > 1000 bytes # 1kb > 1024 bytes # 1m > 1000000 bytes # 1mb > 1024*1024 bytes # 1g > 1000000000 bytes # 1gb > 1024*1024*1024 bytes # # units are case insensiti…

如何安装Apache服务

目录 什么是Apache 第一步 关闭防火墙和安全机制 第二步 系​统​上​定​义 SELinux 最​高​级​别 第三步 导入对应的依赖包并解包 第四步 安装依赖环境 第五步 移动相关文件 第六步 编译安装 第七步 编译 第八步 备份配置文件 第九步 优化执行路径 第十步 添加…

S32K324芯片学习笔记-实时控制系统-eMIOS

文章目录 Enhanced Modular IO Subsystem (eMIOS)eMISO配置通道类型通道配置BCTU Interface 简介功能框图Unified channels (UC)Buffered modesUC control and datapath diagramUC modesGPIO模式SAIC (Single Action Input Capture)模式Single Action Output Capture (SAOC) mo…

AI自动写代码:GitHub copilot插件在Idea的安装和使用教程

GitHub Copilot 是微软与OpenAI共同推出的一款AI编程工具&#xff0c;基于GitHub及其他网站的源代码&#xff0c;根据上文提示为程序员自动编写下文代码&#xff0c;可以极大地提高编写代码的效率。 先看看ChatGpt是怎么回答Copilot的功能特点&#xff1a; 给大家简单提取一…

【go】新手go module 踩坑入门rc_server

go1.3 后废弃了GOPATH 但是gomodule 要自己设置 :go env -w GO111MODULE=auto Microsoft Windows [版本 10.0.22621.1848] © Microsoft Corporation。保留所有权利。 C:\Users\zhangbin>adb connect 127.0.0.1:7555 connected to 127.0.0.1:7555 C:\Users\zhangbin&…

【计算机通识】未来的计算机

欢迎来到博主 Apeiron 的博客&#xff0c;祝您旅程愉快 &#xff01; 时止则止&#xff0c;时行则行。动静不失其时&#xff0c;其道光明。 目录 1、缘起 2、未来的计算机 2.1、光子计算机 2.2、生物计算机 2.3、量子计算机 3、总结 1、缘起 自然界中的一切事物都是处…

3d重建+神经渲染

3d重建 基于深度相机(结构光、TOF、双目摄像头)的三维重建基于图像的三维重建&#xff1a;深度学习基于视觉几何的传统三维重建&#xff1a;这种三维重建方法研究时间比较久远&#xff0c;技术相对成熟。主要通过多视角图像对采集数据的相机位置进行估计&#xff0c;再通过图像…

经典同步问题之哲学家就餐

文章目录 一&#xff1a;问题描述方案一&#xff1a;方案二&#xff1a;方案三&#xff1a; 一&#xff1a;问题描述 五个哲学家共用一张圆桌&#xff0c;分别坐在周围的五张椅子上&#xff0c;在圆桌上有五个碗和五只筷子&#xff0c;他们的生活方式是交替的进行思考和进餐。…

2023年测试岗前景?为什么要做自动化测试?8年测试总结...

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 自动化测试是把以…

Web网页制作期末复习(2)——常用文本标签、列表标签、表格标签、Form表单、块元素与行内元素(内联元素)

目录 常用文本标签 列表标签 有序列表 无序列表 定义列表 表格标签 表格组成与特点 表格标签 表格属性 ​​​合并表格单元格 Form表单 属性说明 表单元素 文本框 密码框 提交按钮 块元素与行内元素&#xff08;内联元素&#xff09; 内联元素和块级元素…

3、DuiLib了解xml的使用和布局

文章目录 1、了解 XML 使用和布局2、VerticalLayout和HorizontalLayout3、TabLayout4、TileLayout5、Container6、ChildLayout 1、了解 XML 使用和布局 本节主要介绍 DuiLib 中 XML 关键字的使用和一些特性&#xff0c;通过构建一个简单的带标题栏和简单结构的窗口&#xff0c…

模型分享---登陆注册界面

目录 模型---登陆注册界面 验证码的生成&#xff1a; CheckCodeUtil.java&#xff1a; Servlet: 普通用户登陆&#xff1a; css: jsp: 运行结果&#xff1a; 管理员登陆&#xff1a; 运行结果&#xff1a; 注册&#xff1a; 普通用户&#xff1a; css: jsp: 运行…

FreeRTOS实时操作系统(三)任务挂起与恢复

系列文章目录 FreeRTOS实时操作系统&#xff08;一&#xff09;RTOS的基本概念 FreeRTOS实时操作系统&#xff08;二&#xff09;任务创建与任务删除&#xff08;HAL库&#xff09; 文章目录 系列文章目录前言任务挂起与恢复普通挂起恢复实例中断恢复实例 前言 继续跟着正点…

记录--封装一个通过js调用的全局vue组件

这里给大家分享我在网上总结出来的一些知识&#xff0c;希望对大家有所帮助 前言 在使用vue项目编写的时候&#xff0c;不可避免的会碰到需要时js api来调用组件进行显示的情况 例如饿了么element ui 的 Notification 通知、Message 消息提示等组件 虽然已经提供了&#xff0c;…

postman和jmete接口测试的用法与区别

目录 前言 接口测试的目的 接口测试怎么测&#xff1a; 1.创建接口用例集&#xff08;没区别&#xff09; 2.步骤的实现&#xff08;有区别&#xff09; 3数据用例的实现 4断言的实现 5执行 6其他 总结&#xff1a; 前言 前阶段做了一个小调查&#xff0c;发现软件测…

DETR 系列有了新发现?DETRs with Hybrid Matching 论文阅读笔记

DETR 系列有了新发现&#xff1f;DETRs with Hybrid Matching 论文阅读笔记 一、Abstract二、引言三、相关工作目标检测中的 DETR其它视觉任务中的 DETR标签赋值 四、方法4.1 基础知识通用的 DETR 框架通用的可变形 Deformable-DETR 框架 4.2 混合匹配4.2.1 混合分支计划一对一…