当前位置: 首页 > news >正文

SpringCloud之nacos共享配置文件实现多数据源灵活切换

目录

前言

1.引入Springboot相关的aop切面依赖

 2.创建自定义注解@DataSourceKey

3.创建对ThreadLocal类

4.创建aop切面

5.创建动态数据源类

6.创建多数据库连接配置类

7.关键代码讲解

8.nacos主要配置


前言

        通过Spring AOP(面向切面编程)的功能来动态地切换数据源。使用@Aspect和@Component注解,通过切面扫描自定义注解,获取数据源的key,可以在不修改原有业务代码的情况下,在service里面的类方法中加入@DataSourceKey注解,即可访问指定的数据源。

1.引入Springboot相关的aop切面依赖

 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency>

 2.创建自定义注解@DataSourceKey

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DataSourceKey {//默认使用auth数据库String value() default "dataSourceSystem";
}

3.创建对ThreadLocal类

        通过线程隔离的方式,实现数据源的切换。

package com.example.auth.datasource;/*** 数据库上下文切换对象,针对每个线程做不同操作*/
public class DataSourceContextHolder {private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();public static void setDataSourceKey(String dataSourceKey) {contextHolder.set(dataSourceKey);}public static String getDataSourceKey() {return contextHolder.get();}public static void clearDataSourceKey() {contextHolder.remove();}
}

4.创建aop切面

        通过包扫描动态切换数据源,主要通过扫描注解的方式获取数据源的key值,即数据源名称。

package com.example.auth.datasource;import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.DeclareAnnotation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/*** 多数据源切面*/
@Aspect
@Component
public class DatasourceAspect {private Logger logger = LoggerFactory.getLogger(DatasourceAspect.class);@Before("@annotation(dataSourceKey) && execution(* com.example.auth.datasource.*.*(..))")public void beforeSwitchDataSource(JoinPoint joinPoint,  DataSourceKey dataSourceKey) {String key = dataSourceKey.value();logger.info("key:{}",key);DataSourceContextHolder.setDataSourceKey(key);}@Before("@annotation(dataSourceKey) && execution(* com.example.auth.service.*.*(..))")public void beforeServiceSwitchDataSource(JoinPoint joinPoint,  DataSourceKey dataSourceKey) {String key = dataSourceKey.value();logger.info("key:{}",key);DataSourceContextHolder.setDataSourceKey(key);}@After("@annotation(dataSourceKey) && execution(* com.example.auth.service.*.*(..))")public void afterServiceSwitchDataSource(JoinPoint joinPoint,  DataSourceKey dataSourceKey) {String key = dataSourceKey.value();logger.info("key:{}",key);DataSourceContextHolder.clearDataSourceKey();}@After("@annotation(dataSourceKey) && execution(* com.example.auth.datasource.*.*(..)) ")public void afterSwitchDataSource(JoinPoint joinPoint, DataSourceKey dataSourceKey) {logger.info("key:{}",dataSourceKey.value());DataSourceContextHolder.clearDataSourceKey();}}

5.创建动态数据源类

        通过该类,可动态改变数据源名称。

package com.example.auth.datasource;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;public class DynamicDataSource extends AbstractRoutingDataSource {private Logger logger = LoggerFactory.getLogger(DynamicDataSource.class);@Overrideprotected Object determineCurrentLookupKey() {String key = DataSourceContextHolder.getDataSourceKey();logger.info("数据源:{}",key);return DataSourceContextHolder.getDataSourceKey();}
}

6.创建多数据库连接配置类

package com.example.auth.datasource;import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;import javax.activation.DataContentHandler;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;/*** 多数据源配置*/
@Configuration
@MapperScan(basePackages = "com.example.auth.mapper")
public class MultiDataSourceConfig {private Logger logger  = LoggerFactory.getLogger(MultiDataSourceConfig.class);@Autowiredprivate DataSource dataSourceAuth;@Autowiredprivate DataSource dataSourceConsumer;@Autowiredprivate DataSource dataSourceMq;@Autowiredprivate DataSource dataSourceGateway;@Autowiredprivate DataSource dataSourceSystem;@Autowired@Qualifier("dynamicDataSource")private DataSource dynamicDataSource;@Autowiredprivate StringEncryptor stringEncryptor;@Bean(name = "dataSourceAuth")@ConfigurationProperties(prefix = "spring.datasource.auth")public DataSource dataSourceAuth() {return DataSourceBuilder.create().build();}@Bean(name = "dataSourceConsumer")@ConfigurationProperties(prefix = "spring.datasource.consumer")public DataSource dataSourceConsumer() {return DataSourceBuilder.create().build();}@Bean(name = "dataSourceMq")@ConfigurationProperties(prefix = "spring.datasource.mq")public DataSource dataSourceMq() {return DataSourceBuilder.create().build();}@Bean(name = "dataSourceGateway")@ConfigurationProperties(prefix = "spring.datasource.gateway")public DataSource dataSourceGateway() {return DataSourceBuilder.create().build();}@Bean(name = "dataSourceSystem")@ConfigurationProperties(prefix = "spring.datasource.system")public DataSource dataSourceSystem() {return DataSourceBuilder.create().build();}@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();//分页插件interceptor.addInnerInterceptor(new PaginationInnerInterceptor());//注册乐观锁插件interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());return interceptor;}@Beanpublic StringEncryptor stringEncryptor() {PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();SimpleStringPBEConfig config = new SimpleStringPBEConfig();config.setPassword("encryptionkey"); // 加密密钥config.setAlgorithm("PBEWithHmacSHA512AndAES_256");config.setKeyObtentionIterations("1000");config.setPoolSize("1");config.setProviderName("SunJCE");config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");config.setStringOutputType("base64");encryptor.setConfig(config);return encryptor;}@PostConstructpublic void init(){/* String  enStr  = stringEncryptor.encrypt("Root@123");String  deSTr  = stringEncryptor.decrypt("N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6");System.out.println("enStr==="+enStr);System.out.println("deSTr==="+deSTr);*/}/*** 不加* @param interceptor* @return* @throws Exception*/@Beanpublic SqlSessionFactory sqlSessionFactory (MybatisPlusInterceptor interceptor) throws Exception {MybatisSqlSessionFactoryBean ssfb = new MybatisSqlSessionFactoryBean();ssfb.setDataSource(dynamicDataSource); // 使用 DynamicDataSourcessfb.setPlugins(interceptor);ssfb.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:/mapper/*Mapper.xml"));return ssfb.getObject();}@Beanpublic DataSource dynamicDataSource() {DynamicDataSource dynamicDataSource = new DynamicDataSource();// 假设你有多个数据源,需要在这里将它们添加到 targetDataSources 中Map<Object, Object> targetDataSources = new HashMap<>();targetDataSources.put("dataSourceSystem", dataSourceSystem);targetDataSources.put("dataSourceAuth", dataSourceAuth);targetDataSources.put("dataSourceConsumer", dataSourceConsumer);targetDataSources.put("dataSourceMq", dataSourceMq);targetDataSources.put("dataSourceGateway",dataSourceGateway);dynamicDataSource.setTargetDataSources(targetDataSources);dynamicDataSource.setDefaultTargetDataSource(dataSourceSystem);// 设置默认数据源return dynamicDataSource;}}

7.关键代码讲解

        注入dynamicDataSource实体,通过该实体bean动态获取数据源,从而达到随意切换数据源的目的。

        单个dataSource的注入,如 dataSourceAuth,主要是给动态数据源的切换提前准备多数据源。

8.nacos主要配置

spring:datasource:system: driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/system?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000auth: driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/auth?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000consumer: driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/consumer?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000mq: driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/mq?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000gateway: driver-class-name: com.mysql.cj.jdbc.Driverjdbc-url: jdbc:mysql://localhost:3306/gateway?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: ENC(N8VBWG5nOHvy5efX3/mlPAmdBykE7iDZFl362LyeaPRXMbLT0PzEIlB/KDXrNYz6)type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000

相关文章:

SpringCloud之nacos共享配置文件实现多数据源灵活切换

目录 前言 1.引入Springboot相关的aop切面依赖 2.创建自定义注解DataSourceKey 3.创建对ThreadLocal类 4.创建aop切面 5.创建动态数据源类 6.创建多数据库连接配置类 7.关键代码讲解 8.nacos主要配置 前言 通过Spring AOP&#xff08;面向切面编程&#xff09;的功能来动…...

原生小程序生成二维码方法之一

效果图&#xff1a; 第一步&#xff1a;下载对应的包并构建&#xff08;工具---》构建npm&#xff09; npm install weapp-qrcode --save 第二步&#xff1a;在wxml页面声明canvas <canvas style"width: 200px; height: 200px;margin:0 auto;" canvas-id"myQ…...

Kubernetes k8s Pod容器 探针 健康探测

目录 Pod容器健康探测 为什么要对容器做探测&#xff1f; 启动探测startupprobe 存活性探测livenessProbe 就绪性探测readinessProbe ReadinessProbe LivenessProbe startupProbe配合使用示例一般程序中需要设置三种探针结合使用&#xff0c;并且也要结合实际情况&#xff…...

Conformal low power-2.电源感知等效性检查

电源感知等效性检查 ■ 第24页&#xff1a;电源感知等效性检查概述 ■ 第24页&#xff1a;启动低功耗&#xff08;等效性检查&#xff09;软件 ■ 第25页&#xff1a;电源感知等效性检查流程 ■ 第28页&#xff1a;电源感知等效性检查示例Do文件 电源感知等效性检查概述…...

【密码学】从有限状态自动机到密钥流生成器

本文是对流密码内容的拓展&#xff0c;在流密码中种子密钥通过一个伪随机数生成器产生一个与明文等长的伪随机密钥流。而本文的内容就是在回答这样两个问题&#xff1a; 伪随机密钥流是如何生成的&#xff1f;流密码、流密钥生成器和有限状态自动机之间是什么关系&#xff1f;…...

3.相机标定原理及代码实现(opencv)

1.相机标定原理 相机参数的确定过程就叫做相机标定。 1.1 四大坐标系及关系 &#xff08;1&#xff09;像素坐标系&#xff08;单位&#xff1a;像素&#xff08;pixel&#xff09;&#xff09; 像素坐标系是指相机拍到的图片的坐标系&#xff0c;以图片的左上角为坐标原点&a…...

Centos7 安装Docker步骤及报错信息(不敢说最全,但是很全)

一、操作系统要求&#xff1a; 要安装Docker Engine&#xff0c;您需要CentOS 7及以上的维护版本。存档版本不受支持或测试。必须启用centos临时存储库。默认情况下&#xff0c;此存储库已启用&#xff0c;但如果已禁用&#xff0c;则需要重新启用它。建议使用overlay2存储驱动…...

【C语言】符号优先级详解

C语言符号优先级详细解析 在C语言中&#xff0c;不同的运算符具有不同的优先级和结合性&#xff0c;这决定了在表达式中运算符的计算顺序。理解这些优先级和结合性是正确编写和理解C语言程序的基础。本文将详细解析C语言中的符号优先级&#xff0c;包括各类运算符的优先级、结…...

天翼云高级运维工程师202407回忆题库 最新出炉

备考天翼云高级运维工程师 必须备考天翼云 之前觉得外企牛批 然后民企&#xff0c;拔地而起&#xff0c;民企也不错&#xff0c;工资高&#xff0c;有钱途 现在看来看去&#xff0c;还是国企好&#xff0c;体制内的&#xff0c;有保障&#xff0c;树大根深 有必要备考下天…...

在Python中什么是上下文管理器以及如何使用with语句来管理资源

什么是上下文管理器&#xff1f; 在Python中&#xff0c;上下文管理器&#xff08;Context Manager&#xff09;是一种支持with语句的协议&#xff0c;允许对象管理资源&#xff0c;如文件、线程锁的获取和释放、数据库连接等。上下文管理器负责资源的分配和释放&#xff0c;确…...

(四)、python程序--贪吃蛇游戏

一、绪论 贪吃蛇游戏。 已实现功能&#xff1a; 1、上下左右移动&#xff1b; 2、吃食物&#xff0c;随机生成食物&#xff1b; 3、碰撞检测&#xff0c;判断是否游戏结束。 二、代码分享 1、main.py import pygame import sys import food as c_food import snake as c…...

什么是DNS欺骗

DNS欺骗&#xff08;DNS Spoofing&#xff09;&#xff0c;也称为DNS缓存中毒&#xff08;DNS Cache Poisoning&#xff09;&#xff0c;是一种网络攻击形式&#xff0c;攻击者通过操纵DNS记录&#xff0c;将用户重定向到一个伪造的、恶意的网站。这些恶意网站可能看起来与用户…...

C++实现对结构体信息排序

思路解读&#xff1a; 定义结构体 Student: 结构体 Student 用来表示学生信息&#xff0c;包含两个成员变量&#xff1a;name&#xff08;学生姓名&#xff09;和 score&#xff08;学生分数&#xff09;。Student 结构体定义了一个构造函数&#xff0c;用于初始化 name 和 sco…...

[CTF]-PWN:House of Cat堆题型综合解析

原理&#xff1a; 调用顺序&#xff1a; exit->_IO_wfile_jumps->_IO_wfile_seekoff->_IO_switch_to_wget_mode _IO_wfile_seekoff源码&#xff1a; off64_t _IO_wfile_seekoff (FILE *fp, off64_t offset, int dir, int mode) {off64_t result;off64_t delta, new…...

18.按键消抖模块设计(使用状态机,独热码编码)

&#xff08;1&#xff09;设计意义&#xff1a;按键消抖主要针对的时机械弹性开关&#xff0c;当机械触点断开、闭合时&#xff0c;由于机械触点的弹性作用&#xff0c;一个按键开关在闭合时不会马上稳定地接通&#xff0c;在断开时也不会一下子就断开。因而在闭合以及断开的瞬…...

【Hec-HMS】第一期:模型简介及软件安装

HEC-HMS模型简介及软件安装 HEC-HMS模型简介建模思路 HEC-HMS软件安装步骤1&#xff1a;安装InstallShield Wizard步骤2&#xff1a;安装HEC-HMS 参考 HEC-HMS模型简介 HEC-HMS(The Hydrologic Engineering Center’s-Hydrologic Modelimng System)&#xff0c;美国陆军工程兵…...

逻辑回归不是回归吗?那为什么叫回归?

RNN 逻辑回归不是回归吗&#xff1f;那为什么叫回归&#xff1f;逻辑回归的基本原理逻辑函数&#xff08;Sigmoid函数&#xff09;二元分类 为什么叫做“回归”&#xff1f;逻辑回归的应用场景总结 逻辑回归不是回归吗&#xff1f;那为什么叫回归&#xff1f; 逻辑回归&#x…...

Activity对象的部分常见成员变量

在Android开发中&#xff0c;Activity 类是一个非常重要的类&#xff0c;它代表了应用程序中的一个屏幕。每个Activity都有一系列的成员变量和方法&#xff0c;这些成员变量通常用于控制和管理活动生命周期、UI界面元素、应用资源等。虽然具体的成员变量会根据Android的不同版本…...

量化交易策略:赌徒在股市会运用凯利公式(附python代码)

一、凯利公式的历史 凯利公式(Kelly Criterion)是由美国贝尔实验室物理学家约翰拉里凯利(John Larry Kelly)于1956年提出的,用于计算最优投资比例的一种数学公式。凯利公式的核心思想是:在期望收益和风险之间找到一个平衡点,使得投资者在承担一定风险的情况下,能够获得…...

信息系统项目管理师【一】英文选择题词汇大全(1)

一、计算机相关词汇 数据挖掘 Data Mining分布式计算 Distributed Computing云计算 Cloud Computing物联网 IOT Internet of Things大数据 Big Data人工智能 artificial intelligence互联网 Internet plus区块链 Blockchain5G 5th-Generation感知层 sensing layer机器学习 mac…...

智慧医疗能源事业线深度画像分析(上)

引言 医疗行业作为现代社会的关键基础设施,其能源消耗与环境影响正日益受到关注。随着全球"双碳"目标的推进和可持续发展理念的深入,智慧医疗能源事业线应运而生,致力于通过创新技术与管理方案,重构医疗领域的能源使用模式。这一事业线融合了能源管理、可持续发…...

Java 语言特性(面试系列1)

一、面向对象编程 1. 封装&#xff08;Encapsulation&#xff09; 定义&#xff1a;将数据&#xff08;属性&#xff09;和操作数据的方法绑定在一起&#xff0c;通过访问控制符&#xff08;private、protected、public&#xff09;隐藏内部实现细节。示例&#xff1a; public …...

反向工程与模型迁移:打造未来商品详情API的可持续创新体系

在电商行业蓬勃发展的当下&#xff0c;商品详情API作为连接电商平台与开发者、商家及用户的关键纽带&#xff0c;其重要性日益凸显。传统商品详情API主要聚焦于商品基本信息&#xff08;如名称、价格、库存等&#xff09;的获取与展示&#xff0c;已难以满足市场对个性化、智能…...

Golang 面试经典题:map 的 key 可以是什么类型?哪些不可以?

Golang 面试经典题&#xff1a;map 的 key 可以是什么类型&#xff1f;哪些不可以&#xff1f; 在 Golang 的面试中&#xff0c;map 类型的使用是一个常见的考点&#xff0c;其中对 key 类型的合法性 是一道常被提及的基础却很容易被忽视的问题。本文将带你深入理解 Golang 中…...

ssc377d修改flash分区大小

1、flash的分区默认分配16M、 / # df -h Filesystem Size Used Available Use% Mounted on /dev/root 1.9M 1.9M 0 100% / /dev/mtdblock4 3.0M...

HBuilderX安装(uni-app和小程序开发)

下载HBuilderX 访问官方网站&#xff1a;https://www.dcloud.io/hbuilderx.html 根据您的操作系统选择合适版本&#xff1a; Windows版&#xff08;推荐下载标准版&#xff09; Windows系统安装步骤 运行安装程序&#xff1a; 双击下载的.exe安装文件 如果出现安全提示&…...

用机器学习破解新能源领域的“弃风”难题

音乐发烧友深有体会&#xff0c;玩音乐的本质就是玩电网。火电声音偏暖&#xff0c;水电偏冷&#xff0c;风电偏空旷。至于太阳能发的电&#xff0c;则略显朦胧和单薄。 不知你是否有感觉&#xff0c;近两年家里的音响声音越来越冷&#xff0c;听起来越来越单薄&#xff1f; —…...

【分享】推荐一些办公小工具

1、PDF 在线转换 https://smallpdf.com/cn/pdf-tools 推荐理由&#xff1a;大部分的转换软件需要收费&#xff0c;要么功能不齐全&#xff0c;而开会员又用不了几次浪费钱&#xff0c;借用别人的又不安全。 这个网站它不需要登录或下载安装。而且提供的免费功能就能满足日常…...

免费PDF转图片工具

免费PDF转图片工具 一款简单易用的PDF转图片工具&#xff0c;可以将PDF文件快速转换为高质量PNG图片。无需安装复杂的软件&#xff0c;也不需要在线上传文件&#xff0c;保护您的隐私。 工具截图 主要特点 &#x1f680; 快速转换&#xff1a;本地转换&#xff0c;无需等待上…...

深度学习水论文:mamba+图像增强

&#x1f9c0;当前视觉领域对高效长序列建模需求激增&#xff0c;对Mamba图像增强这方向的研究自然也逐渐火热。原因在于其高效长程建模&#xff0c;以及动态计算优势&#xff0c;在图像质量提升和细节恢复方面有难以替代的作用。 &#x1f9c0;因此短时间内&#xff0c;就有不…...