[Spring]-AOP

AOP場景

AOP: Aspect Oriented Programming (面向切面編程)

OOP: Object Oriented Programming (面向對象編程)

場景設計

  1. 設計: 編寫一個計算器接口和實現類,提供加減乘除四則運算

  1. 需求: 在加減乘除運算的時候需要記錄操作日志(運算前參數、運算后結果)
  2. 實現方案:
  • 硬編碼
  • 靜態代理
  • 動態代理
  • AOP

硬編碼

使用硬編碼的方式記錄日志

  1. 創建工程環境: 新建模塊, 加一個lombok依賴

  1. 新建計算器接口和實現類, 并在實現類中, 通過硬編碼記錄日志
package com.guigu.aop.calculator;// 定義四則運算
public interface MathCalculator {// 加法int add(int i, int b);// 減法int sub(int i, int b);// 乘法int mul(int i , int b);// 除法int div(int i, int b);
}
package com.guigu.aop.calculator.impl;/*** 計算器實現類* 1. 硬編碼: 不推薦; 耦合:(通用邏輯 + 專用邏輯)希望不要耦合; 耦合太多就是維護地獄*/
@Component
public class MathCalculatorImpl implements MathCalculator {@Overridepublic int add(int i, int b) {System.out.println("[日志] add開始, 參數:" + i + "," + b);int res = i + b;System.out.println("[日志] add結束, 結果:" + res);return res;}@Overridepublic int sub(int i, int b) {return i -b;}@Overridepublic int mul(int i, int b) {return i * b;}@Overridepublic int div(int i, int b) {return  i / b;}
}
  1. 新建單元測試, 測試一下
package com.guigu.aop;@SpringBootTest
public class MathTest {@AutowiredMathCalculatorImpl mathCalculator;@Testvoid test01() {int add = mathCalculator.add(1, 9);}
}

靜態代理

編碼時介入: 包裝真實對象,對外提供靜態代理對象

實現步驟

  1. 包裝被代理對象
  2. 實現被代理對象的接口
  3. 運行時調用被代理對象的真實方法
  4. 外部使用代理對象調用

優點

  • 實現簡單

缺點

  • 需要為不同類型編寫不同代理類,導致擴展維護性差

使用靜態代理技術, 記錄代碼日志

package com.guigu.aop.proxy.statics;import com.guigu.aop.calculator.MathCalculator;
import lombok.Data;
import org.springframework.stereotype.Component;/*** 靜態代理: 定義代理對象, 幫助目標對象完成一些工作*/
@Component
@Data
public class CalculatorStaticProxy implements MathCalculator {private MathCalculator target; // 目標對象public CalculatorStaticProxy(MathCalculator mc) {this.target = mc;}@Overridepublic int add(int i, int b) {System.out.println("[日志] add開始, 參數:" + i + "," + b);int res = target.add(i, b);System.out.println("[日志] add結束, 結果:" + res);return res;}@Overridepublic int sub(int i, int b) {return target.sub(i, b);}@Overridepublic int mul(int i, int b) {return target.mul(i, b);}@Overridepublic int div(int i, int b) {return target.div(i, b);}
}
package com.guigu.aop;@SpringBootTest
public class MathTest {@AutowiredCalculatorStaticProxy calculatorStaticProxy;@Testvoid test02() {int add = calculatorStaticProxy.add(2, 3);}
}

動態代理

運行時介入: 創建真實對象運行時代理對象

  1. 實現步驟
  • ·Java 反射提供 Proxy.newProxyInstance 的方式創建代理對象
  1. 優點:
  • 節約不同代理類的開發
  1. 缺點:
  • 開發難度大
  • 必須有接口,才能創建動態代理

使用動態代理技術, 記錄代碼日志

  1. 封裝一個日志工具類, 提供記錄日志的靜態方法
package com.guigu.aop.log;public class LogUtils {public static void logStart(String name, Object... args) {System.out.println("[日志]: [" + name + "]開始, 參數:" + Arrays.toString(args));}public static void logEnd(String name) {System.out.println("[日志]: [" + name + "]結束");}public static void logException(String name, Throwable e) {System.out.println("[日志]: [" +name+ "]異常: 異常信息:" + e.getCause());}public static void logReturn(String name, Object result) {System.out.println("[日志]: [" + name + "]結束, 返回結果:" + result);}
}
  1. 創建動態代理類 封裝一個靜態方法, 可以傳入任何對象, 返回代理對象
package com.guigu.aop.proxy.dynamic;/*** 動態代理* 1.是java原生支持的技術* 2.運行期間才決定代理關系, 類似于攔截器的思想* 3.目標對象在執行期間會被動態攔截, 可以插入指定邏輯* 4.優點: 可以代理任何對象* 5.缺點: 代碼多* 6.強制要求: 目標對象必須有接口(否則報錯), 代理的也只是接口規定的方法,*/
@Component
public class DynamicProxy {// 獲取目標對象的代理對象public static Object getProxyInstance(Object target) {/*** Proxy是java反射包提供的類* 下面的方法可以創建對象的代理對象, 需要三個參數* Proxy.newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h)* 參數1: ClassLoader loader, 類加載器 (通過類加載器拿到目標對象)* 參數2: Class<?>[] interfaces, 目標對象實現的接口 (通過接口拿到目標對象實現的方法)* 參數3: InvocationHandler h, 代理對象需要執行的方法, 這個方法中可以插入指定邏輯*//*** 攔截方法說明:* 通過攔截方法, 可以攔截到目標對象方法的調用, 從而做任何事情*  (proxy, method, args)-> { }*  proxy: 代理對象*  method: 準備執行的目標對象的方法*  args: 方法調用傳遞的參數*/return Proxy.newProxyInstance(target.getClass().getClassLoader(),target.getClass().getInterfaces(),(proxy, method, args)-> {String name = method.getName();// 記錄開始LogUtils.logStart(name, args);Object result = null;try {result = method.invoke(target, args); // 執行目標對象的方法// 記錄返回值LogUtils.logReturn(name, result);} catch (Exception e) {// 記錄異常LogUtils.logException(name, e);} finally {// 記錄結束LogUtils.logEnd(name);}return result;});}
}
  1. 使用動態代理類的方法創建代理對象
package com.guigu.aop;@SpringBootTest
public class MathTest {@AutowiredMathCalculatorImpl mathCalculator;@AutowiredDynamicProxy dynamicProxy;@Testvoid test03() {MathCalculator instance =(  MathCalculator) dynamicProxy.getProxyInstance(mathCalculator);instance.add(3,5);}
}

AOP使用

了解AOP的術語

AOP基本使用步驟

  1. 導入AOP依賴
    <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency>
  1. 編寫切面Aspect
package com.guigu.aop.aspect;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {}
  1. 編寫通知方法
package com.guigu.aop.aspect;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {public void logStart() {System.out.println("[切面-日志]開始...");}public void logEnd() {System.out.println("[切面-日志]結束...");}public void logReturn() {System.out.println("[切面-日志]返回結果");}public void logException() {System.out.println("[切面-日志]爬出拋出異常:");}
}
  1. 指定切入點表達式
package com.guigu.aop.aspect;import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {/*** 告訴Spring, 以下通知何時何地生效?* 何時?*   通知方法:*   @Before: 方法執行前運行*   @AfterReturning: 方法執行正常返回結果運行*   @AfterThrowing: 方法拋出異常時運行*   @After: 方法執行之后運行*  何地:*    切入點表達式:*       1. execution(方法的全簽名)*       作用: 根據方法匹配切入點*       全寫法: [public] int [com.guigu.aop.calculator].add(int, int) [throws ArithmeticException]*       省略寫法: int add(int, int)*       通配符:*          *: 表示任意字符*         ..: 表示多個參數, 任意類型*       最省略: * *(..)*/@Before("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logStart() {System.out.println("[切面-日志]開始...");}@After("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logEnd() {System.out.println("[切面-日志]結束...");}@AfterReturning("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logReturn() {System.out.println("[切面-日志]返回結果");}@AfterThrowing("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logException() {System.out.println("[切面-日志]爬出拋出異常:");}
}
  1. 測試AOP動態織入
package com.guigu.aop;import com.guigu.aop.calculator.MathCalculator;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;@SpringBootTest
public class AopTest {@Autowired // 容器中注入的是  MathCalculator 的代理對象MathCalculator mathCalculator;@Testvoid test01() {System.out.println(mathCalculator.getClass()); // 看看代理對象mathCalculator.add(10, 20);}
}

AOP細節

切入點表達式

切入點表達式的寫法

package com.guigu.aop.annotation;import java.lang.annotation.*;// 自定義接口
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MyAn {
}
package com.guigu.aop.calculator.impl;import com.guigu.aop.annotation.MyAn;
import com.guigu.aop.calculator.MathCalculator;
import org.springframework.stereotype.Component;/*** 計算器實現類* 1. 硬編碼: 不推薦; 耦合:(通用邏輯 + 專用邏輯)希望不要耦合; 耦合太多就是維護地獄*/
@Component
public class MathCalculatorImpl implements MathCalculator {@Overridepublic int add(int i, int b) {int res = i + b;return res;}@Overridepublic int sub(int i, int b) {return i -b;}@Overridepublic int mul(int i, int b) {return i * b;}@MyAn@Overridepublic int div(int i, int b) {return  i / b;}
}
package com.guigu.aop.aspect;import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {/*** 告訴Spring, 以下通知何時何地生效?* 何時?*   @Before: 方法執行前運行*   @AfterReturning: 方法執行正常返回結果運行*   @AfterThrowing: 方法拋出異常時運行*   @After: 方法執行之后運行*  何地:*    切入點表達式:*       1. execution(方法的全簽名)*       作用: 根據方法匹配切入點*       全寫法: [public] int [com.guigu.aop.calculator].add(int, int) [throws ArithmeticException]*       省略寫法: int add(int, int)*       通配符:*          *: 表示任意字符*         ..: 表示多個參數, 任意類型*       最省略: * *(..)*       2. args(參數類型或其子類型)*       作用: 根據方法的參數匹配切入點*       3. annotation(注解類型)*       作用: 根據方法的注解匹配切入點, 一般配合自定義注解使用*/@Before("args(int, int)")public void logHaha() {System.out.println("[切面-日志]哈哈...");}@Before("@annotation(com.guigu.aop.annotation.MyAn)")public void logHehe() {System.out.println("[切面-日志]呵呵...");}
}
package com.guigu.aop;@SpringBootTest
public class AopTest {@Autowired // 容器中注入的是  MathCalculator 的代理對象MathCalculator mathCalculator;@Testvoid test02() {// 根據方法的參數匹配切入點mathCalculator.add(1, 2);// 測試方法的注解匹配切入點mathCalculator.div(1, 2);}
}

執行順序

AOP 的底層原理

1、Spring會為每個被切面切入的組件創建代理對象(Spring CGLIB 創建的代理對象,無視接口)。

2、代理對象中保存了切面類里面所有通知方法構成的增強器鏈。

3、目標方法執行時,會先去執行增強器鏈中拿到需要提前執行的通知方法去執行

通知方法的執行順序

  1. 正常鏈路: 前置通知->目標方法->返回通知->后置通知
  2. 異常鏈路: 前置通知->目標方法->異常通知->后置通知

連接點信息

通過 JoinPoint 包裝了當前目標方法的所有信息

通過 returning 屬性可以接收當前方法的返回值

通過 throwing 屬性可以接收當前方法的異常信息

package com.guigu.aop.aspect;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {@Before("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logStart(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();// 獲取方法的參數值Object[] args = joinPoint.getArgs();System.out.println("【切面- 日志】【" + name + "】開始:參數列表:【" + Arrays.toString(args) + "】");}@After("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void logEnd(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("[切面-日志] " + name + "結束...");}@AfterReturning(value = "execution(int com.guigu.aop.calculator.MathCalculator.*(..))",returning = "result")public void logReturn(JoinPoint joinPoint, Object result) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 -日志】【" + name + "】返回:值:" + result);}@AfterThrowing(value = "execution(int com.guigu.aop.calculator.MathCalculator.*(..))",throwing = "e")public void logException(JoinPoint joinPoint, Exception e) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 - 日志】【" + name + "】異常:錯誤信息:【" + e.getMessage() + "】");}}

抽取切入點表達式

使用@Pointcut 注解抽取切入點表達式

package com.guigu.aop.aspect;@Component
@Aspect // 告訴spring這個組件是一個切面
public class LogAspect {@Pointcut("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void pointCut(){};@Before("pointCut()")public void logStart(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();// 獲取方法的參數值Object[] args = joinPoint.getArgs();System.out.println("【切面- 日志】【" + name + "】開始:參數列表:【" + Arrays.toString(args) + "】");}@After("pointCut()")public void logEnd(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("[切面-日志] " + name + "結束...");}@AfterReturning(value = "pointCut()",returning = "result")public void logReturn(JoinPoint joinPoint, Object result) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 -日志】【" + name + "】返回:值:" + result);}@AfterThrowing(value = "pointCut()",throwing = "e")public void logException(JoinPoint joinPoint, Exception e) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 - 日志】【" + name + "】異常:錯誤信息:【" + e.getMessage() + "】");}}

多切面的執行順序

默認情況下, 切面方法的執行順序受切面類的首字母排序影響

通過 Order 注解可以指定切面類的優先級

package com.guigu.aop.aspect;@Order(1) // 數值越小, 優先級越高, 執行越早
@Component
@Aspect
public class LogAspect {@Pointcut("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void pointCut(){};@Before("pointCut()")public void logStart(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();// 獲取方法的參數值Object[] args = joinPoint.getArgs();System.out.println("【切面- 日志】【" + name + "】開始:參數列表:【" + Arrays.toString(args) + "】");}@After("pointCut()")public void logEnd(JoinPoint joinPoint) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("[切面-日志] " + name + "結束...");}@AfterReturning(value = "pointCut()",returning = "result")public void logReturn(JoinPoint joinPoint, Object result) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 -日志】【" + name + "】返回:值:" + result);}@AfterThrowing(value = "pointCut()",throwing = "e")public void logException(JoinPoint joinPoint, Exception e) {// 拿到方法全簽名MethodSignature signature = (MethodSignature) joinPoint.getSignature();// 獲取方法名String name = signature.getName();System.out.println("【切面 - 日志】【" + name + "】異常:錯誤信息:【" + e.getMessage() + "】");}
}
package com.guigu.aop.aspect;@Component
@Aspect
public class AuthAspect {@Pointcut("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void pointCut(){};@Before("pointCut()")public void authStart() {System.out.println("[切面-權限] 開始");}@After("pointCut()")public void authEnd() {System.out.println("[切面-權限] 結束");}@AfterReturning("pointCut()")public void authReturn() {System.out.println("【切面 -權限】 返回");}@AfterThrowing("pointCut()")public void authException() {System.out.println("【切面 - 權限】 異常");}}
package com.guigu.aop;@SpringBootTest
public class AopTest {@Testvoid test04() {mathCalculator.add(1, 2);}
}

環繞通知

環繞通知可以控制目標方法是否執行, 修改目標方法的參數和執行結果

package com.guigu.aop.aspect;@Aspect
@Component
public class AroundAspect {/*** 環繞通知的固定寫法如下* Object: 返回值* ProceedingJoinPoint: 可以繼續推進的切入點*/@Pointcut("execution(int com.guigu.aop.calculator.MathCalculator.*(..))")public void pointCut(){};@Around("pointCut()")public Object around(ProceedingJoinPoint pjp) throws Throwable {// 獲取目標方法的參數Object[] args = pjp.getArgs();System.out.println("[切面-環繞前置]: 參數" + Arrays.toString(args));Object proceed = null;try {// 繼續執行目標方法proceed = pjp.proceed(args);System.out.println("[切面-環繞返回]: 返回值" + proceed);} catch (Throwable e) {System.out.println("[切面-環繞異常]: 異常信息" + e.getMessage());throw e; // 拋出異常, 讓別人繼續感知, 否則異常會被吃掉, 影響后面的程序} finally {System.out.println("[切面-環繞后置]");}// 目標方法執行完畢,返回結果return proceed;}
}
package com.guigu.aop;@SpringBootTest
public class AopTest {@Autowired // 容器中注入的是  MathCalculator 的代理對象MathCalculator mathCalculator;@Testvoid test04() {mathCalculator.add(1, 2);}
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/86699.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/86699.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/86699.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Web3 借貸與清算機制全解析:鏈上金融的運行邏輯

Web3 借貸與清算機制全解析&#xff1a;鏈上金融的運行邏輯 超額抵押借款 例如&#xff0c;借款人用ETH為抵押借入DAI&#xff1b;借款人的ETH的價值一定是要超過DAI的價值&#xff1b;借款人可以任意自由的使用自己借出的DAI 穩定幣 第一步&#xff1a;借款人需要去提供一定…

RK3588開發筆記-GNSS-RTK模塊調試

目錄 前言 一、什么是GNSS/RTK 二、硬件連接 三、內核配置 四、模塊調試 五、ntripclient使用 總結 前言 在RK3588平臺上集成高精度定位功能是許多工業級應用的需求。本文記錄了我調試GNSS-RTK模塊的全過程,包含硬件連接、驅動移植、數據解析和精度優化等關鍵環節,希望對…

Vue.js $emit的介紹和簡單使用

前言 在 Vue.js 開發中&#xff0c;組件化是核心思想之一。但組件間的通信是一個重要課題&#xff0c;特別是子組件向父組件傳遞數據的場景。Vue 提供了多種通信方式&#xff0c;而$emit正是實現子→父通信的關鍵方法。本文將深入解析$emit的原理、使用場景及最佳實踐。 一、$e…

【Linux 學習計劃】-- 簡易版shell編寫

目錄 思路 創建自己的命令行 獲取用戶命令 分割命令 檢查是否是內建命令 cd命令實現 進程程序替換執行程序 總代碼 結語 思路 int main() {while (1){// 1. 自己的命令行PrintCommandLine();// 2. 獲取用戶命令char command[SIZE];int n GetUserCommand(command, si…

一個完整的日志收集方案:Elasticsearch + Logstash + Kibana+Filebeat (二)

&#x1f4c4; 本地 Windows 部署 Logstash 連接本地 Elasticsearch 指南 ? 目標 在本地 Windows 上安裝并運行 Logstash配置 Logstash 將數據發送至本地 Elasticsearch測試數據采集與 ES 存儲流程 &#x1f9f0; 前提條件 軟件版本要求安裝說明Java17Oracle JDK 下載 或 O…

Java使用Selenium反爬蟲優化方案

當我們爬取大站的時候&#xff0c;就得需要對抗反爬蟲機制的場景&#xff0c;因為項目要求使用Java和Selenium。Selenium通常用于模擬用戶操作&#xff0c;但效率較低&#xff0c;所以需要我們結合其他技術來實現高效。 在 Java 中使用 Selenium 進行高效反爬蟲對抗時&#xff…

狀態管理方案對比與決策

1. 狀態管理的基本概念 現代前端應用隨著功能復雜度提升&#xff0c;狀態管理已成為架構設計的核心挑戰。狀態管理本質上解決的是數據的存儲、變更追蹤和響應式更新問題&#xff0c;以確保UI與底層數據保持同步。 核心挑戰: 狀態共享與組件通信可預測的狀態變更性能優化與重…

Fetch與Axios:區別、聯系、優缺點及使用差異

Fetch與Axios&#xff1a;區別、聯系、優缺點及使用差異 文章目錄 Fetch與Axios&#xff1a;區別、聯系、優缺點及使用差異一、聯系二、區別1. 瀏覽器支持與兼容性2. 響應處理3. 請求攔截和響應攔截4. 錯誤處理 三、優缺點1. Fetch API優點缺點 2. Axios優點缺點 四、使用上的差…

【Docker】快速入門與項目部署實戰

我們在部署一個項目時&#xff0c;會出現一系列問題比如&#xff1a; 命令太多了&#xff0c;記不住軟件安裝包名字復雜&#xff0c;不知道去哪里找安裝和部署步驟復雜&#xff0c;容易出錯 其實上述問題不僅僅是新手&#xff0c;即便是運維在安裝、部署的時候一樣會覺得麻煩…

Java面試題尚硅谷版第1季

1、寫出如下代碼運行結果 1.1、 使用局部變量表和操作數棧解題 1.2、使用前置和后置遞增解題 2、寫一個單例模式 2.1、考察知識點 2.2、單例模式實現 3、類加載和初始化順序 package classload;public class Father {private int i test();private static int j method();st…

關于Qt阻斷樣式繼承的解決辦法

引言 在使用 Qt 開發桌面應用時&#xff0c;借助樣式表&#xff08;StyleSheet&#xff09;來統一定義界面風格是非常常見的做法。通常&#xff0c;你會在主程序中通過 qApp->setStyleSheet(...) 或者直接給某個父控件設置樣式表&#xff0c;讓所有的子控件都采用相同的配色…

鼠標右鍵添加新建某種文件的方法

場景 我經常用到.emmx&#xff0c;.eddx文件&#xff0c;電腦上裝的是wpsX億圖&#xff08;因為有wps會員&#xff09;&#xff0c;沒有開億圖會員。 然后問題就是&#xff0c;思維導圖和流程圖我都能正常開&#xff0c;正常編輯&#xff0c;但鼠標右鍵沒有新建這兩個文件的按…

Inxpect安全雷達傳感器與控制器:動態檢測 + 抗干擾技術重構工業安全防護體系

Inxpect 推出工業安全領域新型智能傳感器與控制器&#xff0c;其核心產品為雷達掃描儀&#xff0c;具備動態調整檢測區域、抗干擾能力強等特點&#xff0c;可精準檢測危險區域人員進入或存在情況&#xff0c;適用于移動機器人等場景。 Inxpect安全雷達傳感器核心功能 動態檢測…

【AI學習】李廣密與階躍星辰首席科學家張祥雨對談:多模態發展的歷史和未來

仔細閱讀了文章《專訪張祥雨&#xff1a;多模態推理和自主學習是未來的 2 個 「GPT-4」 時刻》 https://mp.weixin.qq.com/s/892QuRPH9uP6zN6dS-HZMw 非常贊嘆的一篇文章&#xff0c;說清楚了NLP、CV發展中的許多重大問題&#xff0c;讀來醍醐灌頂&#xff01;這樣的文章&…

C++中std::deque詳解和實戰工程代碼示例

C中std::deque詳解和實戰工程代碼示例 std::deque&#xff08;雙端隊列&#xff09;是 C 標準庫中的一個序列容器&#xff0c;與 std::vector 類似&#xff0c;但它支持從頭部和尾部高效地插入和刪除元素。它底層采用分段連續空間實現&#xff0c;兼具靈活性與性能。 一、基本…

【AI大模型入門指南】概念與專有名詞詳解 (二)

【AI大模型入門指南】概念與專有名詞詳解 &#xff08;二&#xff09; 一 、前言 當你和聊天機器人聊得天花亂墜時&#xff0c;當你用文字讓AI生成精美圖片時&#xff0c;當手機相冊自動幫你分類照片時 —— 這些看似智能的操作背后&#xff0c;都藏著 AI 大模型的身影。 本…

AIStor 的模型上下文協議 (MCP) 服務器:管理功能

在本系列的上一篇博文中&#xff0c;我們討論了 MinIO AIStor 的模型上下文協議 (MCP) 服務器的基本用戶級功能。我們學習了如何使用人類語言命令查看存儲桶的內容、分析對象并標記它們以便將來處理&#xff0c;以及如何通過 LLM&#xff08;例如 Anthropic Claude&#xff09;…

期權末日輪實值期權盈利未平倉怎么辦?

本文主要介紹期權末日輪實值期權盈利未平倉怎么辦&#xff1f;期權末日輪實值期權盈利未平倉該怎么辦&#xff0c;需要明確幾個關鍵點&#xff1a;末日輪指的是期權到期日臨近的時候&#xff0c;通常指最后一周&#xff0c;尤其是最后一天&#xff0c;這時候時間價值衰減很快&a…

C++/Qt 聯合編程中的定時器使用陷阱:QObject::startTimer 報錯詳解

在 Qt 開發中&#xff0c;QTimer 是一個常用的工具類&#xff0c;用于處理定時事件。但不少開發者在 C/Qt 聯合編程&#xff0c;尤其是在工具類、靜態類、線程中使用定時器時&#xff0c;會遇到如下令人困惑的報錯&#xff1a; QObject::startTimer: Timers can only be used …

CentOS7.9 查詢運維安全日志,排查惡意用戶

1、查看系統版本 cat /etc/redhat-release uname -a 2、查看所有賬號 cat /etc/shadow 3、修改 root 密碼 passwd 3、查看賬號ID id jinzhi 4、查看登錄日志 lastlog 5、查看操作日志 cat .bash_history sudo cat /home/yunwei/.bash_history sudo grep root /va…