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

Mybatis工程升级到FlunetMybatis后引发的问题以及解决方法

0. 背景交代

为了提高开发速度,我打算将公司原有`Mybatis`框架升级为`FlunetMybatis`。可是遇到了一系列问题,下面开始爬坑

工程结构示意如下:

src/
├── main
│   ├── java.com.demo
│   │      ├── Application.java                          //SpringBoot启动类
│   │      ├── aop
│   │      │   └── GlobalExceptionHandler.java     //全局异常处理
│   │      ├── config
│   │      │   └── FluentMybatisGenerator.java     //FluentMybatis配置类
│   │      ├── controler
│   │      │   ├── CommodityController.java        //新功能,使用FluentMybatis
│   │      │   └── FeedbackController.java         //老功能,使用Mybatis
│   │      ├── enums
│   │      ├── mapper
│   │      │   └── FeedbackMapper.java             //MybatisMapper
│   │      ├── mybatis                         //Mybatis拓展
│   │      │   ├── enums                           //枚举类
│   │      │   ├── fluent                          //FluentMybatis代码生成目录
│   │      │   │   ├── dao
│   │      │   │   │   ├── impl
│   │      │   │   │   │   └── CommodityDaoImpl.java //FluentMybatis生成的DAO实现
│   │      │   │   │   └── intf
│   │      │   │   │       └── CommodityDao.java     //FluentMybatis生成的DAO接口
│   │      │   │   └── entity
│   │      │   │       └── CommodityEntity.java  //FluentMybatis生成的数据模型
│   │      │   ├── handler
│   │      │   │   └── StringListHandler.java    //自定义类型转换器(VARCHAR <==> 字符串列表)
│   │      │   └── module
│   │      │       └── StringList.java           //字符串列表
│   │      ├── plugins
│   │      │   ├── files
│   │      │   └── render
│   │      ├── pojo
│   │      │   └── Feedback.java                 //MyBatis数据模型
│   │      ├── service
│   │      │   ├── CommodityService.java         //新功能Service接口
│   │      │   ├── FeedbackService.java          //老功能Service接口
│   │      │   └── impl
│   │      │        ├── CommodityServiceImpl.java    //新功能Service接口实现
│   │      │        └── FeedbackServiceImpl.java     //老功能Service接口实现
│   │      ├── shiro
│   │      └── utils
│   └── resources
│       ├── application-dev.yml
│       ├── application-prod.yml
│       ├── application.yml
│       ├── logback.xml
│       └── mybatis
│           ├── mapper
│           │   └── FeedbackMapper.xml                //Mybatis Mapper XML文件
│           └── mybatis-config.xml
└── test└── java

主要涉及到的配置文件FluentMybatisGenerator内容:

package com.demo.config;import cn.org.atool.fluent.mybatis.spring.MapperFactory;
import cn.org.atool.generator.FileGenerator;
import cn.org.atool.generator.annotation.Column;
import cn.org.atool.generator.annotation.Table;
import cn.org.atool.generator.annotation.Tables;
import com.demo.mybatis.handler.StringListHandler;
import com.demo.mybatis.module.StringList;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;import javax.annotation.Resource;
import javax.sql.DataSource;/*** FluentMybatisConfigurer** @author adinlead* @desc* @create 2023/3/6 13:34 (星期一)*/
@Configuration
@MapperScan({"com.demo.mapper"})
public class FluentMybatisGenerator {/*** 定义fluent mybatis的MapperFactory*/@Beanpublic MapperFactory mapperFactory() {return new MapperFactory();}/*** 生成代码类*/@Tables(srcDir = "src/main/java",basePack = "com.demo.mybatis.fluent", //注意,此处生成代码的路径与原生Mybatis不在同一个包下daoDir = "src/main/java",tablePrefix = {"tb_"},tables = {@Table(value = {"tb_commodity"}, columns = {@Column(value = "create_time", insert = "now()"),@Column(value = "update_time", insert = "now()", update = "now()"),@Column(value = "cover_images", javaType = StringList.class, typeHandler = StringListHandler.class)})})static class CodeGenerator {}
}
  1. 问题以及解决

1.1 FluentMybatis无法自动生成实体类

现象:在运行后,没有在com.demo.mybatis.fluent中生成entity和dao

解决方法:

在FluentMybatisGenerator.java中,在返回自定义fluent mybatis的MapperFactory之前,执行FileGenerator.build方法:

    @Resourceprivate DataSource dataSource;/*** 定义fluent mybatis的MapperFactory*/@Beanpublic MapperFactory mapperFactory() {FileGenerator.build(dataSource, CodeGenerator.class);// 引用配置类,build方法允许有多个配置类return new MapperFactory();}

mvn执行clean 后 再次运行项目即可

效果如下

1.2 自定义SqlSessionFactoryBean导致的一系列问题

官方WIKI-环境部署-简单示例中看到了如下代码:

@Configuration
@MapperScan({"你的Mapper package"})
public class ApplicationConfig {@Bean("dataSource")@Beanpublic DataSource newDataSource() {// TODO}@Beanpublic SqlSessionFactoryBean sqlSessionFactoryBean() throws Exception {SqlSessionFactoryBean bean = new SqlSessionFactoryBean();bean.setDataSource(newDataSource());ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();// 以下部分根据自己的实际情况配置// 如果有mybatis原生文件, 请在这里加载bean.setMapperLocations(resolver.getResources("classpath*:mapper/*.xml"));org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();configuration.setLazyLoadingEnabled(true);configuration.setMapUnderscoreToCamelCase(true);bean.setConfiguration(configuration);return bean;}// 定义fluent mybatis的MapperFactory@Beanpublic MapperFactory mapperFactory() {return new MapperFactory();}
}

在此示例中,作者重定义了SqlSessionFactoryBean,但是如果你没能正确配置,那么这一行为也会导致一系列错误。

1.2.1 Spring无法找到需要注入的对象

错误如下:


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-03-08 13:17:02 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - ***************************
APPLICATION FAILED TO START
***************************Description:A component required a bean of type 'com.demo.mybatis.fluent.mapper.CommodityMapper' that could not be found.Action:Consider defining a bean of type 'com.demo.mybatis.fluent.mapper.CommodityMapper' in your configuration.

这个一般是Spring 进行DI时,找不到FluentMybatis的Mapper引起的错误,原因在于官方文档中要求你在@MapperScan中添加MybatisMapper包路径,但是如果你的MybatisMapper和FluentMybatisMapper不在一个包中时,也需要把FluentMybatis生成的Mapper路径也添加到扫描器中,或者干脆放大扫描范围。

  1. 添加FluentMybatisMapper包路径(推荐)

@Configuration
@MapperScan({"com.demo.mapper", "com.demo.mybatis.fluent.mapper"})
public class FluentMybatisGenerator {...
}
  1. 扩大扫描范围

@Configuration
@MapperScan({"com.demo"})
public class FluentMybatisGenerator {...
}

1.2.2 原MybatisMapper报BindingException错误

调用原生MybatisMapper中的方法时,提示无法映射到方法,错误信息如下:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.demo.mapper.FeedbackMapper.countManagerRecordsat org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53)at org.apache.ibatis.binding.MapperProxy.lambda$cachedInvoker$0(MapperProxy.java:115)at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)at org.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:102)at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)at com.sun.proxy.$Proxy93.countManagerRecords(Unknown Source)at com.demo.service.impl.FeedbackServiceImpl.getManagerFeedbacks(FeedbackServiceImpl.java:77)at com.demo.controler.FeedbackController.getAdminRecords(FeedbackController.java:74)at com.demo.controler.FeedbackController$$FastClassBySpringCGLIB$$80abedc3.invoke(<generated>)

这个错误一般是由于你没有正确配置MyBatis XML文件路径导致的,需要在自定义SqlSessionFactoryBean方法中修改XML文件扫描路径:

    @Beanpublic SqlSessionFactoryBean sqlSessionFactoryBean() throws Exception {SqlSessionFactoryBean bean = new SqlSessionFactoryBean();bean.setDataSource(dataSource);ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();/* 注意!在这里需要将原生Mybatis的XML路径写到配置中 */bean.setMapperLocations(resolver.getResources("classpath*:mybatis/mapper/*.xml"));org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();configuration.setLazyLoadingEnabled(true);configuration.setMapUnderscoreToCamelCase(true);bean.setConfiguration(configuration);return bean;}

1.2.3 Mybatis别名解析错误

在修改完1.2.2问题后,你大概率会碰到这个问题,具体表现为:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [com/demo/shiro/ShiroConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.spring.web.ShiroFilterFactoryBean]: Factory method 'shiroFilterFactoryBean' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [com/demo/shiro/ShiroConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroRealm': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [xxxx/DemoProject/target/classes/com/demo/mapper/UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactoryBean' defined in class path resource [com/demo/config/FluentMybatisGenerator.class]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [xxxx/DemoProject/target/classes/mybatis/mapper/FeedbackMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [xxxx/DemoProject/target/classes/mybatis/mapper/FeedbackMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Feedback'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Feedbackat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270)at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)at com.demo.Application.main(NewCommunity.java:27)

根本原因在MyBatis中:

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [xxxx/DemoProject/target/classes/mybatis/mapper/FeedbackMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Feedback'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Feedbackat org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123)at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:611)... 92 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Feedback'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Feedbackat org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:263)at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:254)at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:246)at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:119)... 94 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Feedback'.  Cause: java.lang.ClassNotFoundException: Cannot find class: Feedbackat org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)... 98 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: Feedbackat org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:196)at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)at org.apache.ibatis.io.Resources.classForName(Resources.java:261)at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)... 100 common frames omitted

据我猜测,其原因在于FluentMybatis没有夹在原生Mybatis的实体类,解决方法很简单,在自定义SqlSessionFactoryBean的方法中,手动添加原生MyBatis实体类所在包即可:

    @Beanpublic SqlSessionFactoryBean sqlSessionFactoryBean() throws Exception {SqlSessionFactoryBean bean = new SqlSessionFactoryBean();bean.setDataSource(dataSource);ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();/* 注意!在这里需要将原生Mybatis的XML路径写到配置中 */bean.setMapperLocations(resolver.getResources("classpath*:mybatis/mapper/*.xml"));org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();configuration.setLazyLoadingEnabled(true);configuration.setMapUnderscoreToCamelCase(true);/* 注意!在这里需要将原生MyBatis的实体类包名添加到TypeAliasRegistry中 */configuration.getTypeAliasRegistry().registerAliases("com.demo.pojo");bean.setConfiguration(configuration);return bean;}

1.2.0 一割解千愁

经过测试,其实不需要自定义SqlSessionFactoryBean也可以正常的将原生MyBatis和FluentMybatis二者结合使用,所以如果上面的方法不能解决问题时,可以尝试将自定义SqlSessionFactoryBean方法删除后再试。

3. 完整的FluentMybatisGenerator.java:

package com.demo.config;import cn.org.atool.fluent.mybatis.spring.MapperFactory;
import cn.org.atool.generator.FileGenerator;
import cn.org.atool.generator.annotation.Column;
import cn.org.atool.generator.annotation.Table;
import cn.org.atool.generator.annotation.Tables;
import com.demo.mybatis.handler.StringListHandler;
import com.demo.mybatis.module.StringList;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;import javax.annotation.Resource;
import javax.sql.DataSource;/*** FluentMybatisConfigurer** @author adinlead* @desc* @create 2023/3/6 13:34 (星期一)*/
@Configuration
public class FluentMybatisGenerator {/*** 从Spring中获取DataSource*/@Resourceprivate DataSource dataSource;/*** 使用定义Fluent Mybatis的MapperFactory*/@Beanpublic MapperFactory mapperFactory() {/* 引用配置类,build方法允许有多个配置类 */FileGenerator.build(dataSource, CodeGenerator.class);return new MapperFactory();}/*** 使用自定义SqlSessionFactoryBean* @return* @throws Exception*/@Beanpublic SqlSessionFactoryBean sqlSessionFactoryBean() throws Exception {SqlSessionFactoryBean bean = new SqlSessionFactoryBean();bean.setDataSource(dataSource);ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();/* 注意!在这里需要将原生Mybatis的XML路径写到配置中 */bean.setMapperLocations(resolver.getResources("classpath*:mybatis/mapper/*.xml"));org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();configuration.setLazyLoadingEnabled(true);configuration.setMapUnderscoreToCamelCase(true);/* 注意!在这里需要将原生Mybatis的XML路径写到配置中 */configuration.getTypeAliasRegistry().registerAliases("com.demo.pojo");bean.setConfiguration(configuration);return bean;}/*** 生成代码类*/@Tables(srcDir = "src/main/java",basePack = "com.demo.mybatis.fluent",daoDir = "src/main/java",tablePrefix = {"tb_"},tables = {@Table(value = {"tb_commodity"}, columns = {@Column(value = "create_time", insert = "now()"),@Column(value = "update_time", insert = "now()", update = "now()"),@Column(value = "cover_images", javaType = StringList.class, typeHandler = StringListHandler.class)})})static class CodeGenerator {}
}

相关文章:

Mybatis工程升级到FlunetMybatis后引发的问题以及解决方法

0. 背景交代为了提高开发速度,我打算将公司原有Mybatis框架升级为FlunetMybatis。可是遇到了一系列问题&#xff0c;下面开始爬坑工程结构示意如下&#xff1a;src/ ├── main │ ├── java.com.demo │ │ ├── Application.java //S…...

Oracle VM VirtualBox6.1.36导入ova虚拟机文件报错,代码: E_INVALIDARG (0x80070057)

问题 运维人员去客户现场部署应用服务&#xff0c;客户是windows server 服务器&#xff08;客户不想买新机器&#xff09;&#xff0c;我们程序是在linux系统里运行&#xff08;其实windows也可以&#xff0c;主要是为了保持各地环境一致方便更新和排查问题&#xff09;我们使…...

Superset数据探索和可视化平台入门以及案例实操

1、Superset背景 1.1、Superset概述 Apache Superset是一个现代的数据探索和可视化平台。它功能强大且十分易用&#xff0c;可对接各种数据源&#xff0c;包括很多现代的大数据分析引擎&#xff0c;拥有丰富的图表展示形式&#xff0c;并且支持自定义仪表盘。 1.2、环境说明 …...

VisualSP Enterprise - February crack

VisualSP Enterprise - February crack VisualSP(可视化支持平台)提供了一个上下文中完全可定制的培训平台&#xff0c;它可以作为企业web应用程序的覆盖层提供。无论员工正在使用什么应用程序&#xff0c;他们都能够快速访问页面培训和指导&#xff0c;说明如何最有效地使用该…...

004+limou+HTML——(4)HTML表格

000、前言 表格在实际开发中的应用还是比较多的&#xff0c;表格可以更加清晰地排列数据 001、基本结构 &#xff08;1&#xff09;构成 表格&#xff1a;<table>行&#xff1a;<tr>&#xff08;table row&#xff0c;表格行&#xff09;&#xff0c;由多少组t…...

uniapp实现自定义相机

自定义相机起因由于最近用uniapp调用原生相机容易出现闪退问题&#xff0c;找了很多教程又是压缩图片又是优化代码&#xff0c;我表示并没有太大作用!!实现自定义相机使用效果图拓展实现多种自定义相机水印相机身份证相机人像相机起因 由于最近用uniapp调用原生相机容易出现闪退…...

插值多项式的龙格现象的介绍与模拟

在文章拉格朗日插值多项式的原理介绍及其应用中&#xff0c;笔者介绍了如何使用拉格朗日插值多项式来拟合任意数据点集。   事实上&#xff0c;插值多项式会更倾向于某些形状。德国数学家卡尔龙格Carl Runge发现&#xff0c;插值多项式在差值区间的端点附近会发生扭动&#x…...

Spring整体架构包含哪些组件?

Spring是一个轻量级java开源框架。Spring是为了解决企业应用开发的复杂性而创建的&#xff0c;它使用基本的JavaBean来完成以前只可能由EJB完成的事情。 Spring的用途不仅限于服务器端的开发&#xff0c;从简单性、可测试性和松耦合的角度而言&#xff0c;任何java应用都可以从…...

开发接口需要考虑哪些问题?

1 接口名字 user/ user/adduser/xxx 见名知意&#xff0c;调用接口的开发人员和后来接手的开发人员能够根据接口名称大致猜测出接口作用。 2 协议 设计接口时&#xff0c;应明确调用接口的协议&#xff0c;是采用HTTP协议,HTTPS协议还是FTP协议。比如跨语言调用通常使用WebS…...

关于Activiti7审批工作流绘画流程图(2)

文章目录一、25张表详解二、安装插件一.定制流程提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、25张表详解 虽然表很多&#xff0c;但是仔细观察&#xff0c;我们会发现Activiti 使用到的表都是 ACT_ 开头的。表名的第二部分用两个字母表明表的用…...

String.format()对日期进行格式化

前言&#xff1a;String.format()作为文本处理工具&#xff0c;为我们提供强大而丰富的字符串格式化功能&#xff0c;这里根据查阅的资料做个学习笔记&#xff0c;整理成如下文章&#xff0c;供后续复习查阅。一. format()方法的两种重载形式&#xff1a;format(String format,…...

核酸检测信息管理系统

目录前言一、功能与需求分析二、详细设计与实现1、data包&#xff08;1&#xff09;DataDataBase&#xff08;2&#xff09;NaPaNamePassword2、operation包&#xff08;1&#xff09;操作接口&#xff08;2&#xff09;Resident用户功能&#xff08;3&#xff09;Simper用户功…...

典型回溯题目 - 全排列(一、二)

典型回溯题目 - 全排列&#xff08;一、二&#xff09; 46. 全排列 题目链接&#xff1a;46. 全排列状 题目大意&#xff1a; 给定一个不含重复数字的数组 nums &#xff0c;返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 注意&#xff1a;&#xff08;1&#xf…...

数据清洗和特征选择

数据清洗和特征选择 数据清洗和特征挖掘的工作是在灰色框中框出的部分&#xff0c;即“数据清洗>特征&#xff0c;标注数据生成>模型学习>模型应用”中的前两个步骤。 灰色框中蓝色箭头对应的是离线处理部分。主要工作是 从原始数据&#xff0c;如文本、图像或者应…...

java StringBuilder 和 StringBuffer 万字详解(深度讲解)

StringBuffer类介绍和溯源StringBuffer类常用构造器和常用方法StringBuffer类 VS String类&#xff08;重要&#xff09;二者的本质区别&#xff08;含内存图解&#xff09;二者的相互转化StringBuilder类介绍和溯源StringBuilder类常用构造器和常用方法String类&#xff0c;St…...

【Linux】帮助文档查看方法

目录1 Linux帮助文档查看方法1.1 man1.2 内建命令(help)1 Linux帮助文档查看方法 1.1 man man 是 Linux 提供的一个手册&#xff0c;包含了绝大部分的命令、函数使用说明。 该手册分成很多章节&#xff08;section&#xff09;&#xff0c;使用 man 时可以指定不同的章节来浏…...

UEFI 实战(2) HelloWorld 之一 helloworld及.inf文件

初识UEFI 按惯例&#xff0c;首先让我们用HelloWorld跟UEFI打个招呼吧 标准application /*main.c */ #include <Uefi.h> EFI_STATUS UefiMain ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { SystemTable -> ConOut-> OutputString(SystemTab…...

向2022年度商界木兰上榜女性致敬!

目录 信息来源&#xff1a; 2022年度商界木兰名单 简介 评选标准 动态 榜单 为你心中的2023商界女神投上一票 信息来源&#xff1a; 2022年度商界木兰榜公布 华为孟晚舟获商界木兰最高分 - 脉脉 【最具影响力女性】历届商界木兰榜单 中国最具影响力的30位商界女性名单…...

ChatGPT助力校招----面试问题分享(二)

1 ChatGPT每日一题&#xff1a;DC-DC与LDO的区别 问题&#xff1a;介绍一下DC-DC与LDO的区别 ChatGPT&#xff1a;DC-DC和LDO都是电源管理电路&#xff0c;它们的主要作用是将输入电压转换为所需的输出电压&#xff0c;以供电子设备使用。但是&#xff0c;它们之间存在一些重…...

JAVA架构与开发(JAVA架构是需要考虑的几个问题)

在企业中JAVA架构师主要负责企业项目技术架构&#xff0c;企业技术战略制定&#xff0c;技术框架搭建&#xff0c;技术培训和技术攻坚的工作。 在JAVA领域&#xff0c;比较多的都是web项目。用于解决企业的数字化转型。对于JAVA架构师而言&#xff0c;平时对项目的架构主要考虑…...

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…...

JavaSec-RCE

简介 RCE(Remote Code Execution)&#xff0c;可以分为:命令注入(Command Injection)、代码注入(Code Injection) 代码注入 1.漏洞场景&#xff1a;Groovy代码注入 Groovy是一种基于JVM的动态语言&#xff0c;语法简洁&#xff0c;支持闭包、动态类型和Java互操作性&#xff0c…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

VB.net复制Ntag213卡写入UID

本示例使用的发卡器&#xff1a;https://item.taobao.com/item.htm?ftt&id615391857885 一、读取旧Ntag卡的UID和数据 Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click轻松读卡技术支持:网站:Dim i, j As IntegerDim cardidhex, …...

在 Nginx Stream 层“改写”MQTT ngx_stream_mqtt_filter_module

1、为什么要修改 CONNECT 报文&#xff1f; 多租户隔离&#xff1a;自动为接入设备追加租户前缀&#xff0c;后端按 ClientID 拆分队列。零代码鉴权&#xff1a;将入站用户名替换为 OAuth Access-Token&#xff0c;后端 Broker 统一校验。灰度发布&#xff1a;根据 IP/地理位写…...

oracle与MySQL数据库之间数据同步的技术要点

Oracle与MySQL数据库之间的数据同步是一个涉及多个技术要点的复杂任务。由于Oracle和MySQL的架构差异&#xff0c;它们的数据同步要求既要保持数据的准确性和一致性&#xff0c;又要处理好性能问题。以下是一些主要的技术要点&#xff1a; 数据结构差异 数据类型差异&#xff…...

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

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

NFT模式:数字资产确权与链游经济系统构建

NFT模式&#xff1a;数字资产确权与链游经济系统构建 ——从技术架构到可持续生态的范式革命 一、确权技术革新&#xff1a;构建可信数字资产基石 1. 区块链底层架构的进化 跨链互操作协议&#xff1a;基于LayerZero协议实现以太坊、Solana等公链资产互通&#xff0c;通过零知…...

Linux --进程控制

本文从以下五个方面来初步认识进程控制&#xff1a; 目录 进程创建 进程终止 进程等待 进程替换 模拟实现一个微型shell 进程创建 在Linux系统中我们可以在一个进程使用系统调用fork()来创建子进程&#xff0c;创建出来的进程就是子进程&#xff0c;原来的进程为父进程。…...

MySQL 知识小结(一)

一、my.cnf配置详解 我们知道安装MySQL有两种方式来安装咱们的MySQL数据库&#xff0c;分别是二进制安装编译数据库或者使用三方yum来进行安装,第三方yum的安装相对于二进制压缩包的安装更快捷&#xff0c;但是文件存放起来数据比较冗余&#xff0c;用二进制能够更好管理咱们M…...