【连接池】-从源码到适配(下),使用dynamic-datasource导致连接池没生效(升级版本)

写在前面

  书接上文,连接池没生效,启用了一个什么默认的连接池。具体是什么,一起来看看源码吧。


目录

  • 写在前面
  • 一、问题描述
  • 二、本地调试
  • 三、升级dynamic-datasource
  • 四、新的问题
    • (一)数据源初始化问题
    • (二)GaussDB updatedTime NULL值问题
  • 五、参考资料
  • 写在后面
  • 系列文章


一、问题描述

  连接池没生效,无外乎就是 yml 的配置没读取到、连接池没创建或者创建失败了。因为没报错,所以极大的可能是 yml 配置没读取到。


二、本地调试

启动项目,debug一下,果然用的是Tomcat的连接池。
在这里插入图片描述

这里,默认根据 DATA_SOURCE_TYPE_NAMES 加载,发现 classpath 中有哪个就用哪个。

package org.springframework.boot.autoconfigure.jdbc;
public class DataSourceBuilder {private static final String[] DATA_SOURCE_TYPE_NAMES = new String[] {"org.apache.tomcat.jdbc.pool.DataSource","com.zaxxer.hikari.HikariDataSource","org.apache.commons.dbcp.BasicDataSource", // deprecated"org.apache.commons.dbcp2.BasicDataSource" };public DataSource build() {Class<? extends DataSource> type = getType();DataSource result = BeanUtils.instantiate(type);maybeGetDriverClassName();bind(result);return result;}public Class<? extends DataSource> findType() {if (this.type != null) {return this.type;}for (String name : DATA_SOURCE_TYPE_NAMES) {try {// 遍历到第一个就返回了,第一个就是tomcat的return (Class<? extends DataSource>) ClassUtils.forName(name,this.classLoader);}catch (Exception ex) {}}return null;}}

那就再找一下连接池初始化数量,进一步确认。果然也正如料想的那样,初始化数量是10个。

package org.apache.tomcat.jdbc.pool;
public class PoolProperties implements PoolConfiguration, Cloneable, Serializable {private volatile int initialSize = 10;
}

那现在就很明确了,是不是添加完dynamic-datasource之后影响了原有的连接池加载?其实这个时候从properties文件中就已经看出问题了:压根没有dbcp2的节点,貌似也不支持dbcp2连接池(只有druid 和 hikari)

以下是 DynamicDataSourceProperties 和 DataSourceProperty(yml的对应实体)。

package com.baomidou.dynamic.datasource.spring.boot.autoconfigure;/*** DynamicDataSourceProperties** @author TaoYu Kanyuxia* @see DataSourceProperties* @since 1.0.0*/
@Slf4j
@Getter
@Setter
@ConfigurationProperties(prefix = DynamicDataSourceProperties.PREFIX)
public class DynamicDataSourceProperties {public static final String PREFIX = "spring.datasource.dynamic";public static final String HEALTH = PREFIX + ".health";/*** 必须设置默认的库,默认master*/private String primary = "master";/*** 是否启用严格模式,默认不启动. 严格模式下未匹配到数据源直接报错, 非严格模式下则使用默认数据源primary所设置的数据源*/private Boolean strict = false;/*** 是否使用p6spy输出,默认不输出*/private Boolean p6spy = false;/*** 是否使用 spring actuator 监控检查,默认不检查*/private boolean health = false;/*** 每一个数据源*/private Map<String, DataSourceProperty> datasource = new LinkedHashMap<>();/*** 多数据源选择算法clazz,默认负载均衡算法*/private Class<? extends DynamicDataSourceStrategy> strategy = LoadBalanceDynamicDataSourceStrategy.class;/*** aop切面顺序,默认优先级最高*/private Integer order = Ordered.HIGHEST_PRECEDENCE;/*** Druid全局参数配置*/@NestedConfigurationPropertyprivate DruidConfig druid = new DruidConfig();/*** HikariCp全局参数配置*/@NestedConfigurationPropertyprivate HikariCpConfig hikari = new HikariCpConfig();/*** 全局默认publicKey*/private String publicKey = CryptoUtils.DEFAULT_PUBLIC_KEY_STRING;
}package com.baomidou.dynamic.datasource.spring.boot.autoconfigure;/*** @author TaoYu* @since 1.2.0*/
@Slf4j
@Data
@Accessors(chain = true)
public class DataSourceProperty {/*** 加密正则*/private static final Pattern ENC_PATTERN = Pattern.compile("^ENC\\((.*)\\)$");/*** 连接池名称(只是一个名称标识)</br> 默认是配置文件上的名称*/private String pollName;/*** 连接池类型,如果不设置自动查找 Druid > HikariCp*/private Class<? extends DataSource> type;/*** JDBC driver*/private String driverClassName;/*** JDBC url 地址*/private String url;/*** JDBC 用户名*/private String username;/*** JDBC 密码*/private String password;/*** jndi数据源名称(设置即表示启用)*/private String jndiName;/*** 自动运行的建表脚本*/private String schema;/*** 自动运行的数据脚本*/private String data;/*** 错误是否继续 默认 true*/private boolean continueOnError = true;/*** 分隔符 默认 ;*/private String separator = ";";/*** Druid参数配置*/@NestedConfigurationPropertyprivate DruidConfig druid = new DruidConfig();/*** HikariCp参数配置*/@NestedConfigurationPropertyprivate HikariCpConfig hikari = new HikariCpConfig();/*** 解密公匙(如果未设置默认使用全局的)*/private String publicKey;public String getUrl() {return decrypt(url);}public String getUsername() {return decrypt(username);}public String getPassword() {return decrypt(password);}/*** 字符串解密*/private String decrypt(String cipherText) {if (StringUtils.hasText(cipherText)) {Matcher matcher = ENC_PATTERN.matcher(cipherText);if (matcher.find()) {try {return CryptoUtils.decrypt(publicKey, matcher.group(1));} catch (Exception e) {log.error("DynamicDataSourceProperties.decrypt error ", e);}}}return cipherText;}
}

咋整?难道不用这个动态数据源,自己写一套?项目紧急,时间上不允许呀!
另外,不可能不支持dbcp2连接池额,走,去官网GitHub上看看。


三、升级dynamic-datasource

官网链接 https://github.com/baomidou/dynamic-datasource/tree/v3.3.4/src/main

不看不知道,一看吓一跳。
源码版本直接从V1.1.0直接到V3.3.0,中间的版本没有了。
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
查看源码,确实从3.3.4版本开始支持dbcp2版本数据源(目前用的是2.5.7),那就升级到3.5.2(4.x之后结构又发生了很大变化)

在这里插入图片描述

升级完,yml中配置的连接池生效了 ~

❗️ 技巧:
这也给我们提了一个醒,在引入一个新的框架时,
一定要先去对应的GitHub仓库看源码,不能只依赖于maven仓库。成熟的产品,大都高版本是兼容低版本的。低版本不行,就去试试高版本~

四、新的问题

(一)数据源初始化问题

好用是好用,但是存在一个新的问题:dynamic-datasource会在项目启动时,加载所有的数据源并进行连接,然后通过@DS来动态切换数据源。

显然,这和我们的需求不太一样。我们并不想项目一启动就把所有的数据源都加载了,只想primary配置成哪个,就加载哪个数据源。

看源码,找到数据源加载的位置,确实这里把所有数据源全加载了。

以下是加载数据源的源码部分:

public abstract class AbstractDataSourceProvider implements DynamicDataSourceProvider {@Autowiredprivate DataSourceCreator dataSourceCreator;protected Map<String, DataSource> createDataSourceMap(Map<String, DataSourceProperty> dataSourcePropertiesMap) {Map<String, DataSource> dataSourceMap = new HashMap<>(dataSourcePropertiesMap.size() * 2);for (Map.Entry<String, DataSourceProperty> item : dataSourcePropertiesMap.entrySet()) {DataSourceProperty dataSourceProperty = item.getValue();String pollName = dataSourceProperty.getPoolName();if (pollName == null || "".equals(pollName)) {pollName = item.getKey();}dataSourceProperty.setPoolName(pollName);dataSourceMap.put(pollName, dataSourceCreator.createDataSource(dataSourceProperty));}return dataSourceMap;}
}

那好办,取出primary属性,判断一下就可以了。
修改如下:

package com.baomidou.dynamic.datasource.provider;import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;/*** @author TaoYu*/
@Slf4j
public abstract class AbstractDataSourceProvider implements DynamicDataSourceProvider {@Autowiredprivate DefaultDataSourceCreator defaultDataSourceCreator;@Autowiredprivate DynamicDataSourceProperties dynamicDataSourceProperties;protected Map<String, DataSource> createDataSourceMap(Map<String, DataSourceProperty> dataSourcePropertiesMap) {Map<String, DataSource> dataSourceMap = new HashMap<>(dataSourcePropertiesMap.size() * 2);for (Map.Entry<String, DataSourceProperty> item : dataSourcePropertiesMap.entrySet()) {String dsName = item.getKey();// 只加载 yml配置文件中 primary指定的数据源if (dsName.equals(dynamicDataSourceProperties.getPrimary())) {DataSourceProperty dataSourceProperty = item.getValue();String poolName = dataSourceProperty.getPoolName();if (poolName == null || "".equals(poolName)) {poolName = dsName;}dataSourceProperty.setPoolName(poolName);dataSourceMap.put(dsName, defaultDataSourceCreator.createDataSource(dataSourceProperty));}}return dataSourceMap;}
}

想让源码的文件生效有两种方式:
第一种把jar包中的文件copy出来,在项目下创建相同的包名。
第二种改源码。

因为我们有Nexus私服,这里就采用第二种方式,修改源码,维护一个自己的版本,也方便后期自定义。

构建nexus私服构件,下载源码,在pom中配置,以及maven的settings.xml中的认证,deploy即可到远程私服上查看是否部署成功。

修改依赖版本为自定义构建的版本 3.5.2.companyName。重新部署完项目,发现连接数瞬间变小,由原来的到230多变为40多。

❗️ 注意:这里说一下题外话,项目中还有一个问题,这也是下一个要重构的目标。目前各个项目单独引用SpringBoot(版本可能还不太一样),数据源dbcp2连接池也就被分散到各个项目中,导致无法统一。
因为dbcp2的版本是在springboot中定义的。为什么无法统一?看下面示例
在maven项目,父项目中<dependencyManagement>定义一个jar包的版本1.0,
子项目A定义一个jar包版本2.0,子项目B依赖子项目A。
这个时候子项目B的jar包版本不是2.0,而是1.0。因为子项目A的2.0是会覆盖父项目中的版本,而子项目B只是依赖A,不会覆盖父项目中的1.0。

(二)GaussDB updatedTime NULL值问题

做数据库兼容时,还遇到一个问题:当程序中实体的 updatedTime 日期字段设置为null进行操作时,GaussDB数据库不支持自动更新。

GaussDB没有MySQL的这种 ON UPDATE功能,它认为你传的updatedTime 的值就是NULL,导致数据库NOT NULL 报错。

updatedTime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

对于这个问题,你可以像Oracle一样通过触发器实现,但是加触发器也需要加很多(还会影响性能)。

我之前有用过MyBatis-plugins的属性填充,那我是否可以为MyBatis自定义一个属性填充?了解MyBatis的我们知道,可以通过拦截器实现,搞定。

以下为属性填充的拦截器:

package com.zhht.mybatis.interceptor;import com.alibaba.fastjson.JSON;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlCommandType;
import org.apache.ibatis.plugin.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
import java.util.Properties;/*** 拦截SQL,进行对象属性填充* 解决GaussDB数据库,表字段不支持 ON UPDATE CURRENT_TIMESTAMP*/
@Intercepts(@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
)
public class MetaObjectInterceptor implements Interceptor {private static final Logger LOGGER = LoggerFactory.getLogger(MetaObjectInterceptor.class);private static final String TABLE_FIELD_CREATE_TIME = "createTime";private static final String TABLE_FIELD_CREATED_TIME = "createdTime";private static final String TABLE_FIELD_GMT_CREATE = "gmtCreate";private static final String TABLE_FIELD_UPDATE_TIME = "updateTime";private static final String TABLE_FIELD_UPDATED_TIME = "updatedTime";private static final String TABLE_FIELD_GMT_MODIFIED = "gmtModified";@Overridepublic Object intercept(Invocation invocation) throws Throwable {MappedStatement ms = (MappedStatement) invocation.getArgs()[0];Object parameter = invocation.getArgs()[1];LOGGER.info("MetaObjectInterceptor - intercept [method: {}] start!", ms.getId());if (!Objects.isNull(parameter)) {SqlCommandType sqlCommandType = ms.getSqlCommandType();if (SqlCommandType.INSERT == sqlCommandType || SqlCommandType.UPDATE == sqlCommandType) {BoundSql boundSql = ms.getBoundSql(parameter);String beforeParameter = JSON.toJSONString(boundSql.getParameterObject());LOGGER.info("MetaObjectInterceptor - intercept [method: {}, before params: {}]", ms.getId(), beforeParameter);Class<?> clazz = parameter.getClass();if (clazz.getSuperclass().isInstance(Object.class)) {fillFields(parameter.getClass().getDeclaredFields(), parameter, sqlCommandType);} else {Class<?> superclass = clazz.getSuperclass();fillFields(superclass.getDeclaredFields(), parameter, sqlCommandType);}String afterParameter = JSON.toJSONString(boundSql.getParameterObject());LOGGER.info("MetaObjectInterceptor - intercept [method: {}, after params: {}]", ms.getId(), afterParameter);}}LOGGER.info("MetaObjectInterceptor - intercept [method: {}] successful!", ms.getId());return invocation.proceed();}@Overridepublic Object plugin(Object target) {return Plugin.wrap(target, this);}@Overridepublic void setProperties(Properties properties) {}/*** 填充属性** @param declaredFields 参数字段* @param parameter      参数实体* @param sqlCommandType sql类型* @throws IllegalAccessException*/private void fillFields(Field[] declaredFields, Object parameter, SqlCommandType sqlCommandType) throws IllegalAccessException {for (Field field : declaredFields) {field.setAccessible(true);if (isNeedFill(sqlCommandType, field.getName(), field.get(parameter))) {doFill(field, parameter);}}}/*** 设置值** @param field 字段* @param parameter 参数实体*/private void doFill(Field field, Object parameter) throws IllegalAccessException {if (Date.class == field.getType()) {field.set(parameter, new Date());} else if (Timestamp.class == field.getType()) {field.set(parameter, new Timestamp(System.currentTimeMillis()));} else if (Long.class == field.getType()) {field.set(parameter, System.currentTimeMillis());} else {LOGGER.warn("MetaObjectInterceptor - doFill [type: {} is not support!]", field.getType().getName());}}/*** 判断字段是否需要填充* 逻辑:包含且非空** @param sqlCommandType sql类型* @param fieldName  字段名称* @param filedValue 字段值* @return*/private boolean isNeedFill(SqlCommandType sqlCommandType, String fieldName, Object filedValue) {if (SqlCommandType.INSERT.equals(sqlCommandType)) {// create和update字段,为了效率, 不使用list.containsif (TABLE_FIELD_CREATE_TIME.equals(fieldName)|| TABLE_FIELD_CREATED_TIME.equals(fieldName)|| TABLE_FIELD_GMT_CREATE.equals(fieldName)|| TABLE_FIELD_UPDATE_TIME.equals(fieldName)|| TABLE_FIELD_UPDATED_TIME.equals(fieldName)|| TABLE_FIELD_GMT_MODIFIED.equals(fieldName)) {return Objects.isNull(filedValue);}} else if (SqlCommandType.UPDATE.equals(sqlCommandType)) {// 只考虑update字段,时时更新if (TABLE_FIELD_UPDATE_TIME.equals(fieldName)|| TABLE_FIELD_UPDATED_TIME.equals(fieldName)|| TABLE_FIELD_GMT_MODIFIED.equals(fieldName)) {return true;}}return false;}}/*** MyBatis自动配置** @author qiuxianbao* @date 2023/10/31*/
@Configuration
@EnableConfigurationProperties
public class MyBatisAutoConfiguration {/*** 支持多种数据库产品* @return*/@Bean@ConditionalOnMissingBeanpublic DatabaseIdProvider getDatabaseIdProvider() {VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();databaseIdProvider.setProperties(DatabaseVendorLoadUtils.load());return databaseIdProvider;}/*** 添加属性填充拦截器* @return*/@Beanpublic Interceptor metaObjectInterceptor() {return new MetaObjectInterceptor();}}

至此,项目初步完成改造,后续观察,封版提测。
至于源码的事儿,敬请关注看图说话专栏或者系列文章~


五、参考资料

Github dynamic-datasource


写在后面

  如果本文内容对您有价值或者有启发的话,欢迎点赞、关注、评论和转发。您的反馈和陪伴将促进我们共同进步和成长。


系列文章

【连接池】-从源码到适配(上),你遇到过数据库连接池的问题吗?This connection has been closed
【源码】-MyBatis-如何系统地看源码

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

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

相关文章

css+js实现鼠标移动边框高亮效果

前言&#xff1a;效果是鼠标移入空白区域&#xff0c;边框高亮的效果。效果是在douyin的渡一教育袁老师的课程学习到的&#xff0c;观看以后是一个实用的小特效。想看的可以平台查询&#xff0c;自己也学到了知识。 <!DOCTYPE html> <html lang"en"> <…

Selenium在vue框架下求生存

vue框架下面&#xff0c;没有id、没有name&#xff0c;vue帮开发做了很多脏活累活&#xff0c;却委屈了写页面自动化测试的人&#xff08;当然&#xff0c;也给爬信息的也带来了一定的难处&#xff09;。这里只能靠总结&#xff0c;用一些歪门邪道&#xff1a; 一、跟开发商量…

安装Windows版本沐神的autocut

参考 下载完autocut以后 1 下载ffmpeg

ios苹果app应用程序录屏开发有哪些难点和注意点?

首先&#xff0c;让我们简单了解一下iOS录屏的基本原理。iOS录屏是指将设备屏幕上的内容实时捕捉并保存为视频文件的过程。这在教学、演示和用户支持等场景中非常有用。iOS录屏可以通过使用ReplayKit框架来实现&#xff0c;该框架提供了一套API&#xff0c;用于捕捉屏幕上的内容…

Notepad++批量更改文件编码格式及文档格式

背景&#xff1a; 在项目中遇到Windows平台VS的MSVC编译不识别Unix下UTF-8编码导致的编译失败问题。需要将Unix下的UTF-8转为UTF-8-BOM格式。网上找了些方式&#xff0c;之后又深入探究了下文档转换的可能性&#xff0c;共享给大家。&#xff08;当然Windows和Unix平台代码格式…

Halcon阈值处理的几种分割方法threshold/auto_threshold/binary_threshold/dyn_threshold

Halcon阈值处理的几种分割方法 文章目录 Halcon阈值处理的几种分割方法1. 全局阈值2. 基于直方图的自动阈值分割方法3. 自动全局阈值分割方法4. 局部阈值分割方法5. var_threshold算子6 . char_threshold 算子7. dual_threshold算子 在场景中选择物体或特征是图像测量或识别的重…

Linux网络编程学习心得.4

1.epoll工作模式 水平触发 LT 边沿触发 ET 因为设置为水平触发,只要缓存区有数据epoll_wait就会被触发,epoll_wait是一个系统调用,尽量少调用 所以尽量使用边沿触发,边沿出触发数据来一次只触发一次,这个时候要求一次性将数据读完,所以while循环读,读到最后read默认带阻塞…

springboot(ssm火锅店管理系统 火锅在线点餐系统 Java系统

springboot(ssm火锅店管理系统 火锅在线点餐系统 Java系统 开发语言&#xff1a;Java 框架&#xff1a;ssm/springboot vue JDK版本&#xff1a;JDK1.8&#xff08;或11&#xff09; 服务器&#xff1a;tomcat 数据库&#xff1a;mysql 5.7&#xff08;或8.0&#xff09; …

Java中的设计模式

设计模式是软件开发中常见问题的可重用解决方案。在Java中&#xff0c;设计模式有助于提高代码的可维护性、可读性和可扩展性。以下是一篇关于Java中设计模式的文章&#xff0c;以帮助您更好地理解这些模式。 一、设计模式简介 设计模式是经过验证的解决方案&#xff0c;用于…

Glary Utilities Pro - 电脑系统优化全面指南:详尽使用教程

软件简介&#xff1a; Glary Utilities Pro 是一款全面的电脑优化工具&#xff0c;它旨在帮助用户提升计算机的性能和稳定性。这款软件提供了多种功能&#xff0c;包括系统清理、优化、修复以及保护。通过一键扫描&#xff0c;它可以识别并清除无用文件、临时数据、注册表错误等…

AI大模型时代下运维开发探索第二篇:基于大模型(LLM)的数据仓库

在SREWorks社区聚集了很多进行运维数仓建设的同学&#xff0c;大家都会遇到类似的挑战和问题&#xff1a; 数仓中存储大量数据消耗成本&#xff0c;但很多存储的数据却并没有消费。进数仓的ETL学习成本高、管理成本高&#xff0c;相关同学配合度低&#xff0c;以及上游结构改动…

【Go语言入门:Go语言的方法,函数,接口】

文章目录 4.Go语言的方法&#xff0c;函数&#xff0c;接口4.1. 方法4.1.1. 指针接受者4.1.2. 值接收者和指针接收者有什么区别&#xff1f;4.1.3. 方法 4.2. 接口4.2.1. 接口定义 4.3. 函数4.3.1. 函数介绍 4.Go语言的方法&#xff0c;函数&#xff0c;接口 4.1. 方法 4.1.1…

element表格排序功能

官方展示 个人项目 可以分别对每一项数据进行筛选 注&#xff1a;筛选的数据不能是字符串类型必须是数字类型&#xff0c;否则筛选会乱排序 html <el-table :data"tableData" border height"600" style"width: 100%"><el-table-co…

spring boot使用配置文件对静态变量进行赋值

spring boot value ConfigurationProperties 注释静态配置文件变量引用 1.value 标签加在set方法上面&#xff0c;注意set方法是非静态 private static String userName;Value(value "${user.userName}")public void setUserName(String userName) {HelloWorldServ…

K8s陈述式资源管理

命令行&#xff1a;kubectl命令行工具 优点&#xff1a;90%以上的场景都可以满足 对资源的增删改查比较方便&#xff0c;对改不是很友好。 缺点&#xff1a;命令比较冗长&#xff0c;复杂&#xff0c;难记 声明式&#xff1a; 看到声明式都是k8s当中的yml文件来实现资源管理…

面试题-性能优化

前端项目优化&#xff1a; 一般考虑方面: (挑几点记住) 我们学的: 懒加载: 路由、图片懒加载 骨架屏的使用 压缩文件&#xff1a;可以使用压缩工具&#xff08;如GZIP&#xff09;对页面文件进行压缩&#xff0c;减小文件大小&#xff0c;提高页面加载速度。 减少HTTP请求&a…

什么是uniapp?用uniapp开发好不好用?

随着移动应用市场的持续发展&#xff0c;开发者们面临着不断增长的需求和多样化的平台选择。在这个背景下&#xff0c;UniApp 应运而生&#xff0c;成为一种跨平台开发框架&#xff0c;为开发者提供了一种高效、简便的方式来开发移动应用程序。利用 UniApp 开发应用程序可以节省…

天擎终端安全管理系统clientinfobymid存在SQL注入漏洞

产品简介 奇安信天擎终端安全管理系统是面向政企单位推出的一体化终端安全产品解决方案。该产品集防病毒、终端安全管控、终端准入、终端审计、外设管控、EDR等功能于一体&#xff0c;兼容不同操作系统和计算平台&#xff0c;帮助客户实现平台一体化、功能一体化、数据一体化的…

Django 文件上传(十二)

当 Django 处理文件上传时&#xff0c;文件数据最终会被放置在 request.FILES 。 查看文档&#xff1a;文件上传 | Django 文档 | Django Django工程如下&#xff1a; 创建本地存储目录 在static/应用目录下创建uploads目录用于存储接收上传的文件 在settings.py 配置静态目…

flutter实践:Isolate应用实例二

需求&#xff1a;尝试将Isolate封装一层便于直接使用 实现&#xff1a; 1.定义一个封装类 class TdxIsolate {//创建一个isolateIsolate? newIsolate;//新isolate发送器SendPort? childSender;//存放结果集List results [];//构造方法TdxIsolate() {//初始化isolate crea…