当前位置: 首页 > 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;平时对项目的架构主要考虑…...

vue 中 v-for 的使用

v-for 获取列表的前 n 条、中间范围、末尾 n 条的数据 list: [{ img: /static/home/news1.png, title: 标题1 },{ img: /static/home/news2.png, title: 标题2 },{ img: /static/home/news1.png, title: 标题3 },{ img: /static/home/news2.png, title: 标题4 },{ img: /stati…...

项目--基于RTSP协议的简易服务器开发(2)

一、项目创立初衷&#xff1a; 由于之前学过计算机网络的相关知识&#xff0c;了解了计算机网络的基本工作原理&#xff0c;对于主流的协议有一定的了解。但对于应用层的协议还知之甚少&#xff0c;因此我去了解了下目前主要的应用层传输协议&#xff0c;发现RTSP&#xff08;…...

ubus编译_环境搭建

文章目录一、环境搭建脚本toolChain_jsonc.cmaketoolChain_libubox.cmaketoolChain_ubus.cmakeinstall.sh二、测试出现问题&#xff1a;三、测试uloopmain.c 每5s打印信息一、环境搭建脚本 准备四个文件 install.sh,toolChain_jsonc.cmake,toolChain_libubox.cmake,toolChai…...

移动通信(16)信号检测

常见的信号检测算法一般包括以下几类检测算法&#xff1a;最优、线性和非线性。最优检测算法&#xff1a;最大似然算法线性检测算法&#xff1a;迫零检测算法和最小均方误差检测算法非线性检测算法&#xff1a;串行干扰消除检测算法球形译码检测算法属于一种次优检测算法&#…...

数据结构与算法之《顺序表》

目录 1.什么是顺序表 顺序表的优势和缺点 顺序表预备知识 顺序表的代码实现 顺序表头部插入 顺序表的销毁 顺序表的头删 顺序表的尾删 顺序表的尾插 顺序表的任意位置插入 顺序表的查找 顺序表的打印 1.什么是顺序表 这篇文章我们来讲一下基础数据结构的顺序表&…...

MySQL索引15连问,抗住!

1. 索引是什么&#xff1f;索引是一种能提高数据库查询效率的数据结构。它可以比作一本字典的目录&#xff0c;可以帮你快速找到对应的记录。索引一般存储在磁盘的文件中&#xff0c;它是占用物理空间的。正所谓水能载舟&#xff0c;也能覆舟。适当的索引能提高查询效率&#x…...

【服务器管理】手动部署LNMP环境(CentOS 8)(非阿里云版本)

简述 如果是你是阿里云的服务器&#xff0c;我推荐你看引用的文章&#xff0c;本文也是参考了很多这篇文章的内容。 https://help.aliyun.com/document_detail/173042.htm 系统版本&#xff1a; CentOS 8 其实CentOS 7的版本可能更好安装一点&#xff0c;但是我有个服务推荐使…...

论文笔记:Positive-incentive Noise

2022 TNNLS 中心思想是&#xff1a;噪声并不一定是有害的 1 CV问题中的噪声 以图像分类为例 对图像加入适量的噪声后再训练&#xff0c;识别准确率反而上升了 再以目标检测为例&#xff1a; 从遥感影像中做飞机检测&#xff0c;一般都是把飞机紧紧框住&#xff0c;然后做…...

340秒语音芯片,轻松实现语音交互,畅享智能生活WTV380语音ic方案

随着智能家居、安防报警、宠物用品 等&#xff0c;智能设备的普及&#xff0c;语音交互技术正在逐渐成为人机交互的主要方式之一。而如何实现稳定高效的语音交互&#xff0c;就需要借助先进的语音芯片技术。今天&#xff0c;我们介绍的是一款高性能的语音芯片——WTV380&#x…...

有java基础学习大数据该如何规划

大数据开发对于Java语言的依赖程度比较高&#xff0c;如果想尝试大数据开发&#xff0c;学习过Java语言就很容易上手 Java是目前使用广泛的编程语言之一&#xff0c;具有的众多特性&#xff0c;特别适合作为大数据应用的开发语言。 目前很多大数据开发团队都在使用Java语言&a…...