MyBatis深度解析與實戰指南:細節完整,從入門到精通

MyBatis深度解析與實戰指南:細節完整,從入門到精通

整理這份筆記,是因為學習 MyBatis 時發現很多教程要么只講基礎 CRUD,要么直接跳到 Spring 整合,對 MyBatis 核心特性講解不全面,基礎部分也不夠完整。實際開發中,很多問題在教程中找不到答案,比如二級緩存配置后性能提升不明顯、動態 SQL 拼接后查詢結果不符合預期、事務管理不當導致數據不一致等。

這些問題讓我意識到,掌握 MyBatis 不僅要知其然,更要知其所以然。于是,我決定邊學邊記錄,用最直白的語言和圖示梳理核心知識點,注重細節的完整性和實用性,希望能幫你少走彎路,真正掌握 MyBatis 的精髓。

一、Mybatis的介紹

  • Myba是一款優秀的持久層框架
  • MyBatis 避免了幾乎所有的 JDBC 代碼和手動設置參數以及獲取結果集的過程,減少了代碼的冗余,減少程序員的操作。

二、Mybatis的構建

首先是整體結構

在這里插入圖片描述

1、首先是util,主要用于的是構建一個SqlSessionFactory的框架

    private static SqlSessionFactory sqlSessionFactory;static{try {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);} catch (IOException e) {throw new RuntimeException(e);}}public static SqlSession getSqlSession(){return sqlSessionFactory.openSession();}

static部分可以在Mybatis3中文文檔中查找

2、然后是pojo,主要是用于設置一個user的,用于規定類型

public class user {private int id;private String name;private String pwd;}

實現里面的無參,有參,set,toStrring方法即可

最后是dao部分的內容,主要是用于實現方法,設置增刪改查可以在這里面進行

dao里面有兩部分,Mapper是一個接口,用于設置需要實現類的方法,另一個用于數據庫操作的功能實現

3、dao部分

在這里插入圖片描述

xml部分

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chen.dao.Mapper"><select id="getUserList" resultType="com.chen.pojo.user">select * from mybatis.user;</select><select id="getUserId" resultType="com.chen.pojo.user" parameterType="int" >select * from mybatis.user where id=#{id};</select><insert id="addUser" parameterType="com.chen.pojo.user">insert into mybatis.user (id, name, pwd) values (#{id}, #{name}, #{pwd})</insert><delete id="deleteUser" parameterType="int">delete from mybatis.user where id = #{id}</delete><update id="UpdateUser" parameterType="com.chen.pojo.user">update mybatis.user set name=#{name},pwd=#{pwd} where id= #{id}</update>
</mapper>

namespce用于dao中的接口部分

id用于實現的方法

resultTypr用于返回的類型

parameterType用于規范文件的類型

4、XML部分

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--configuration核心配置文件-->
<configuration><environments default="development"><environment id="development"><transactionManager type="JDBC"/><dataSource type="POOLED"><property name="driver" value="com.mysql.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=true&amp;characterEncoding=UTF-8&amp;useUnicode=true&amp;serverTimezone=GMT"/><property name="username" value="root"/><property name="password" value="123456"/></dataSource></environment></environments><mappers><mapper resource="com/chen/dao/UserMapper.xml"/></mappers>
</configuration>

5、測試類(可以在user類快捷鍵ctrl+shift+T)

@Testpublic void testGetUserList() {SqlSession sqlSession= MaybaitsUtils.getSqlSession();Mapper userDao = sqlSession.getMapper(Mapper.class);List<user> userList = userDao.getUserList();for (user user : userList) {System.out.println(user);}sqlSession.close();}@Testpublic void testgetId(){SqlSession sqlSession = MaybaitsUtils.getSqlSession();Mapper mapper = sqlSession.getMapper(Mapper.class);user user = mapper.getUserId(2);System.out.println(user);}@Testpublic void testAdd() {SqlSession sqlSession = MaybaitsUtils.getSqlSession();try {Mapper mapper = sqlSession.getMapper(Mapper.class);int res = mapper.addUser(new user(6, "張勝男", "1234588"));if (res > 0) {System.out.println("插入成功");sqlSession.commit();} else {System.out.println("插入失敗");}} catch (Exception e) {e.printStackTrace();// 處理異常,可能需要回滾事務// sqlSession.rollback();} finally {sqlSession.close();}}@Testpublic void testdelete(){SqlSession sqlSession = MaybaitsUtils.getSqlSession();Mapper mapper = sqlSession.getMapper(Mapper.class);int row = mapper.deleteUser(5);if(row>0)System.out.println("刪除成功");sqlSession.commit();sqlSession.close();}

commit用于預編譯,可以在前面的Mybatis中加入true,可以自動預編譯

map的使用

int addUser2(Map<String,Object> map);
    <insert id="addUser2" parameterType="map">insert into mybatis.user (id,pwd) values (#{userid},#{password})</insert>
     public void addUser2(){SqlSession sqlSession = MybatisUtils.getSqlSession();UserMapper mapper = sqlSession.getMapper(UserMapper.class);Map<String,Object> map = new HashMap<String, Object>();map.put("userid",4);map.put("password","123321");mapper.addUser2(map);sqlSession.commit();sqlSession.close();}

三、核心配置文件

properties(屬性)
settings(設置)
typeAliases(類型別名)
typeHandlers(類型處理器)
objectFactory(對象工廠)
plugins(插件)
environments(環境配置)
environment(環境變量)
transactionManager(事務管理器)
dataSource(數據源)
databaseIdProvider(數據庫廠商標識)
mappers(映射器)

可以在Mybatis3中文文檔上查找相關用法

1、properties(屬性)

可以通過設置properties來引用配置文件

eg:

<!--引入外部配置文件-->
<properties resource="db.properties"><property name="username" value="root"/><property name="pwd" value="123123"/>
</properties>

可以不寫中的內容,這樣寫了該值會二次覆蓋資源里面的內容

resource代表著內置資源的位置

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mybatis?useSSL=true&amp;characterEncoding=UTF-8&amp;useUnicode=true&amp;serverTimezone=GMT
name=root
password=123456

2、typeAliases(別名設置)

<!--可以給實體類起別名-->
<typeAliases><typeAlias type="com.kuang.pojo.User" alias="User" />
</typeAliases>

這個為直接設置別名

<!--可以給實體類起別名-->
<typeAliases><package name="com.kuang.pojo"/>
</typeAliases>

這個為默認首字母小寫的類名

注解:@Alias(“user”)實體類可以直接設置

3、setting(其他效果在這里面進行實現)

<settings><setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>

這個就是設置日志的,可以讓日志輸出更加的完整

4、mapper的三種用法

    <mappers><mapper resource="chen/dao/UserMapper.xml"/>
<!--        接口名與資源名必須一致,放在同一個包下面-->
<!--        <mapper class="chen.dao.UserMapper.xml"/>-->
<!--        接口名與資源必須一致,放在同一個包下面-->
<!--        <package name="chen.dao"/>--></mappers>

class和name都需要接口名與資源名必須一致,放在同一個包下面

在這里插入圖片描述

四、ResultMap的使用

ResultMap主要是用于類名中有別名存在又不能直接更改類之中的內容,就可以通過resultmap進行改名

<resultMap id="users" type="user"><result column="pwd" property="password"></result>
</resultMap>
<select id="getUserList" resultMap="users">select * from mybatis.user;
</select>

resultMap對應id,types對應要改的類型

column代表mysql數據庫中的名字,property代表類中的名字

五、日志的使用

1、STDOUT_LOGGING標準日志

<settings><setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>

在這里插入圖片描述

2、Log4j

原理:以控制日志信息輸送的目的地是控制臺、文件、GUI組件

設置先關資源

在這里插入圖片描述

相關配置

log4j.rootLogger = DEBUG,console ,file#控制臺輸出的相關設置
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.Threshold = DEBUG
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern =  [%c]-%m%n#文件輸出的相關設置
log4j.appender.file = org.apache.log4j.RollingFileAppender
log4j.appender.file.File = ./log/kuang.log
log4j.appender.file.MaxFileSize = 10mb
log4j.appender.file.Threshold = DEBUG
log4j.appender.file.layout = org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern = [%p][%d{yy-MM-dd}][%c]%m%n#日志輸出級別
log4j.logger.org.mybatis=DEBUG
log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
<settings><setting name="logImpl" value="LOG4J"/>
</settings>

在這里插入圖片描述

可以自定義進行設置

@Testpublic  void testLogger(){logger.info("info:系統進入info");logger.debug("debug:系統進入debug");logger.error("eroor:系統報錯");
}

在這里插入圖片描述

必須使用下面內容

static Logger logger = Logger.getLogger(UserDaoTest.class);

最后可以生成一個log日志文文件

六、Limit分頁的使用

1、sql中的分頁

//分頁
List<User> getUserByLimit(Map<String,Integer> map);
    <select id="getUserByLimit" parameterType="map" resultMap="UserMap">select * from mybatis.user limit #{startIndex},#{pageSize}</select>
    public void getUserByLimit(){SqlSession sqlSession = MybatisUtils.getSqlSession();UserMapper mapper = sqlSession.getMapper(UserMapper.class);HashMap<String, Integer> map = new HashMap<String, Integer>();map.put("startIndex",0);map.put("pageSize",2);List<User> userList = mapper.getUserByLimit(map);for (User user : userList) {System.out.println(user);}sqlSession.close();}

2、RowBounds分頁

//分頁2
List<User> getUserByRowBounds();
  <select id="getUserByRowBounds" resultMap="UserMap">select * from mybatis.user</select>
@Test
public void getUserByRowBounds(){SqlSession sqlSession = MybatisUtils.getSqlSession();//RowBounds實現RowBounds rowBounds = new RowBounds(0, 2);//通過java代碼層面實現分頁List<User> userList = sqlSession.selectList("com.kuang.dao.UserMapper.getUserByRowBounds",null,rowBounds);for (User user : userList) {System.out.println(user);}sqlSession.close();
}

七、注解開發

優點:簡單代碼更加便捷,可以在接口中直接完成,不需要xml中進行操作

缺點:負載的代碼還是無法進行,仍然需要不注解的使用方法

1、基礎增刪改查

    @Select(" select * from mybatis.user")List<user> getListuser();@Select("select * from mybatis.user where id=#{id}")user getid(@Param("id") int id);@Insert("insert into mybatis.user (id, name, pwd) values (#{id}, #{name}, #{pwd})" )int addUser(user user);@Delete("delete from mybatis.user where id = #{id}")int deleteUser(@Param("id") int id);@Update("update mybatis.user set name=#{name},pwd=#{pwd} where id= #{id}")int updateuser(user user);

mybatis-config.xml需要改配置

<!--綁定接口!-->
<mappers><mapper class="com.kuang.dao.UserMapper" />
</mappers>

改成class以應對沒有resource

測試類不進行改變

@Param設置基礎類型,以這里面的內容為優先

2、其他類型

lombok的設置,可以從maven中導入

<dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.34</version><scope>provided</scope></dependency>
</dependencies>
@Data
@AllArgsConstructor
@NoArgsConstructor

Data包含基本所有的基本類型(無參構造、get、set、toString、hashCode、equals)

AllArgsConstructor有參構造

NoArgsConstructor無參構造

八、一對一和一對多

概念:

  • 多個學生,對應一個老師
  • 對于學生而言,關聯–多個學生,關聯一個老師【多對一】
  • 對于老師而言,集合–一個老師,有很多個學生【一對多】

1、association一對一

在這里插入圖片描述

兩個類進行表示

student表示學生類

private int id;
private String name;
private teacher teacher;

student類中的teahcer屬性跟下方的teacher類是有聯系的,這個也代表了數據庫中的tid

teacher老師類

public class teacher {private int id;private String name;
}

方法一:

原理:在兩個類中分別進行查找,再將兩個類查找的結果進行結合

<mapper namespace="chen.dao.studentMapper"><resultMap id="student" type="chen.pojo.student"><id property="id" column="id"></id><result property="name" column="name"/><association property="teacher" column="tid" select="getTeacher" javaType="chen.pojo.teacher"/></resultMap><select id="getStudent" resultMap="student">select * from Mybatis.student</select><select id="getTeacher" resultType="chen.pojo.teacher">select * from Mybatis.teacher</select>
</mapper>

namespace是和接口相互聯系的,填寫對應接口的位置

property指類中的名字

column指數據庫中的名字

select指要選擇的名字和下方id對應

javaType和resultType對應

方法二:

原理主:要在于數據庫的相關設計

<!--按照結果嵌套處理    -->
<select id="getStudent2" resultMap="StudentTeacher2">select s.id sid,s.name sname,t.name tnamefrom mybatis.student s,mybatis.teacher twhere s.tid = t.id
</select><resultMap id="StudentTeacher2" type="Student"><result property="id" column="sid"/><result property="name" column="sname"/><association property="teacher" javaType="chen.pojo.teacher"><result property="name" column="tname"/></association>
</resultMap>

2、collection一對多

方法一:

teacher類:

public class teacher {private int id;private String name;private List<student> students;
}

teacher類的xml

<mapper namespace="chen.dao.teacherMapper"><resultMap id="Teacher" type="chen.pojo.teacher"><id property="id" column="id"></id><result property="name" column="name"/><collection property="students"  select="studentMapper" javaType="Arraylist" ofType="chen.pojo.student" column="id"/></resultMap><select id="getTeacher" resultMap="Teacher">select * from Mybatis.teacher;</select><select id="studentMapper" resultType="chen.pojo.student">select * from Mybatis.student;</select>
</mapper>

一對多有五個屬性

1、property=“students” 類中有的

2、select=“studentMapper” 選擇的名字

3、javaType="Arraylist 數列類型

4、ofType=“chen.pojo.student” 設定約束的泛型

5、column=“id” 數據庫中的代表

方法二:

<!--    按結果嵌套查詢-->
<select id="getTeacher" resultMap="TeacherStudent">SELECT  s.id sid,s.name sname,t.name tname,t.id,tidfrom student s,teacher twhere s.tid = t.id and t.id = #{tid}
</select><resultMap id="TeacherStudent" type="Teacher"><result property="id" column="tid"/><result property="name" column="tname"/><!--  復雜的屬性,我們需要單獨處理 對象:association 集合:collectionjavaType="" 指定屬性的類型!集合中的泛型信息,我們使用ofType獲取--><collection property="students" ofType="Student"><result property="id" column="sid"/><result property="name" column="sname"/><result property="tid" column="tid"/></collection>
</resultMap>

九、動態SQL

原來:動態SQL就是 指根據不同的條件生成不同的SQL語句

1、if語句

可以選擇的進行添加方法

List<blog> queryblogs(Map map);
<select id="queryblogs" parameterType="map" resultType="pojo.blog">select * from mybatis.blog<where><if test="title!=null">AND title = #{title}</if><if test="id!=null">and id = #{id}</if></where>
</select>

如果里面的值不為空就會添加(通過map實現比較好)

@Test
public void testblog(){SqlSession sqlSession = Mybatis.getSqlsession();blogMapper mapper = sqlSession.getMapper(blogMapper.class);HashMap map = new HashMap();map.put("title","Java");List<blog> queryblog = mapper.queryblogs(map);for (blog blog : queryblog) {System.out.println(blog);}
}

2、choose語句

從許多語句中選一句來進行

<select id="chooseIF" parameterType="map" resultType="pojo.blog">select * from mybatis.blog<where><choose><when test="title!=null">title = #{title}</when><when test="author!=null">author = #{author}</when><otherwise>views = #{views}</otherwise></choose></where>
</select>

3、set語句

專門進行修改操作

<update id="updates" parameterType="map">update Mybatis.blog<set><if test="title!=null"> title = #{title}</if><if test="author!=null">author = #{author}</if></set>where id = #{id}
</update>

4、Foreachs語句

可以選擇的進行需要輸出多少個

<select id="Foreachs" parameterType="map" resultType="pojo.blog">select * from mybatis.blog<where><foreach item="id" open="and (" close=")" separator="or" collection="items">id = #{id}</foreach></where>
</select>

select * from blog where 1=1 and (id=1 or id=2 or id=3)

item代表下面的屬性名,就是id

open代表從1=1 后面開始的內容

close代表結束的內容

separator表示中間的分隔符號

collection主要是后面測試的Arraylist的名字

測試

@Test
public void testlimit(){SqlSession sqlsession = Mybatis.getSqlsession();blogMapper mapper = sqlsession.getMapper(blogMapper.class);ArrayList<Integer> item = new ArrayList<>();item.add(1);item.add(3);HashMap hashMap = new HashMap();hashMap.put("items",item);List<blog> foreachs = mapper.Foreachs(hashMap);for (blog foreach : foreachs) {System.out.println(foreach);}sqlsession.close();
}

5、sql片段

將一些功能部分抽出,方便使用

<sql id="if-title-author"><if test="title != null">title = #{title}</if><if test="author != null">and author = #{author}</if>
</sql>

sql里面的就為封裝的

使用:

<select id="queryBlogIF" parameterType="map" resultType="Blog">select * from mybatis.blog<where><include refid="if-title-author"></include></where>
</select>

十、緩存

將數據存儲在緩存當中,用戶就不用再去重新查找數據,可以加快效率

1、一級緩存

Sqlsession默認是開啟的,close來進行關閉

  • 與數據庫同一次會話期間查詢到的數據會放在本地緩存中。
  • 以后如果需要獲取相同的數據,直接從緩存中拿,沒必要再去查詢數據庫

在查詢不同東西的時候會重新進行

在增刪改查之后會重新進行緩存操作

clearCache可以手動清理緩存

2、二級緩存

一級緩存范圍太小,不夠用

二級緩存可以在一級緩存用close關閉后還存在

在mybatis-config.xml開啟全局緩存

    <!--顯示的開啟全局緩存--><setting name="cacheEnabled" value="true"/>

在要使用二級緩存的Mapper中開啟

<!--在當前Mapper.xml中使用二級緩存-->
<cache/>

自定義參數

<!--在當前Mapper.xml中使用二級緩存-->
<cacheeviction="FIFO"flushInterval="60000"size="512"readOnly="true"/>

readonly是必須要有的,不然會報錯

參考資料

  • 狂神說MyBatis系列視頻
  • MyBatis官方文檔

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

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

相關文章

【科學技術部政務服務平臺-用戶注冊/登錄安全分析報告】

前言 由于網站注冊入口容易被黑客攻擊&#xff0c;存在如下安全問題&#xff1a; 暴力破解密碼&#xff0c;造成用戶信息泄露短信盜刷的安全問題&#xff0c;影響業務及導致用戶投訴帶來經濟損失&#xff0c;尤其是后付費客戶&#xff0c;風險巨大&#xff0c;造成虧損無底洞…

【Audio開發三】音頻audio中幀frameSize ,周期大小periodsize,緩沖區buffer原理詳解以及代碼流程分析

一、基礎概述 在分析獲取最小幀數前&#xff0c;我們先來了解幾個相關的概念。 1&#xff0c;幀 幀&#xff08;frame&#xff09;&#xff1a;表示一個完整的聲音單元&#xff0c;所謂的聲音單元是指一個采樣樣本。如果是雙聲道&#xff0c;那么一個完整的聲音單元就是 2 個樣…

K8S學習之基礎七十五:istio實現灰度發布

istio實現灰度發布 上傳鏡像到harbor 創建兩個版本的pod vi deployment-v1.yaml apiVersion: apps/v1 kind: Deployment metadata:name: appv1labels:app: v1 spec:replicas: 1selector:matchLabels:app: v1apply: canarytemplate:metadata:labels:app: v1apply: canaryspec…

C++藍橋杯填空題(攻克版)

片頭 嗨~小伙伴們&#xff0c;咱們繼續攻克填空題&#xff0c;先把5分拿到手~ 第1題 數位遞增的數 這道題&#xff0c;需要我們計算在整數 1 至 n 中有多少個數位遞增的數。 什么是數位遞增的數呢&#xff1f;一個正整數如果任何一個數位不大于右邊相鄰的數位。比如&#xf…

【Python】數據結構

【Python】數據結構&#xff1a; Series&#xff1a;1、通過列表創建Series類對象2、顯示地給數據指定標簽索引3、通過字典創建Series類對象4、獲取索引5、獲取數據 DataFrame&#xff1a;1、通過數組創建一個DataFrame類對象2、指定列索引3、指定行索引4、獲取列的數據5、查看…

Android XML布局與Compose組件對照手冊

下面我將詳細列出傳統 XML 布局中的組件與 Compose 組件的對應關系&#xff0c;幫助您更好地進行遷移或混合開發。 基礎布局對應 XML 布局Compose 組件說明LinearLayout (vertical)Column垂直排列子項LinearLayout (horizontal)Row水平排列子項FrameLayoutBox層疊子項Relativ…

云原生運維在 2025 年的發展藍圖

隨著云計算技術的不斷發展和普及&#xff0c;云原生已經成為了現代應用開發和運維的主流趨勢。云原生運維是指在云原生環境下&#xff0c;對應用進行部署、監控、管理和優化的過程。在 2025 年&#xff0c;云原生運維將迎來更加廣闊的發展前景&#xff0c;同時也將面臨著一系列…

js day5

復習模板字符串&#xff1a; 在輸出語句里面 document.write(我今年${a}歲了)中間是反引號&#xff1b;里面是${變量}&#xff1b; 復習基本類型 number String null undefined boolean 檢測數據類型輸出typedf 變量則可&#xff1b; 添加鏈接描述 復習樣式變量table什么的邊…

SmolVLM2: The Smollest Video Model Ever(三)

這是對《SmolLM2: When Smol Goes Big — Data-Centric Training of a Small Language Model》的翻譯閱讀 摘要 雖然大語言模型在人工智能的許多應用中取得了突破&#xff0c;但其固有的大規模特性使得它們在計算上成本高昂&#xff0c;并且在資源受限的環境中部署具有挑戰性。…

汽車軟件開發常用的需求管理工具匯總

目錄 往期推薦 DOORS&#xff08;IBM &#xff09; 行業應用企業&#xff1a; 應用背景&#xff1a; 主要特點&#xff1a; Polarion ALM&#xff08;Siemens&#xff09; 行業應用企業&#xff1a; 應用背景&#xff1a; 主要特點&#xff1a; Codebeamer ALM&#x…

爬蟲工程師雜活工具人

30歲的年齡;這個年齡大家都是成年人;都是做父母的年齡了;你再工位上的心態會發生很大變化的; 爬蟲工程師基本都是如此;社會最low的一幫連銷售都做不了的;單子都開不出來的然后轉行做爬蟲工程師的;這樣的人基本不太和社會接觸; 你作為爬蟲初級工程師就敲著鍵盤然后解析著html;…

如何使用Tomcat

1 簡介 Tomcat是Apache 軟件基金會&#xff08;Apache Software Foundation&#xff09;的Jakarta 項目中的一個核心項目&#xff0c;由Apache、Sun 和其他一些公司及個人共同開發而成。因為Tomcat 技術先進、性能穩定&#xff0c;而且免費&#xff0c;成為目前比較流行的Web 應…

【AI工具】FastGPT:開啟高效智能問答新征程

前言 在人工智能飛速發展的當下&#xff0c;各類 AI 工具如雨后春筍般涌現。FastGPT 作為一款基于大語言模型&#xff08;LLM&#xff09;的知識圖譜問答系統&#xff0c;憑借其強大的數據處理和模型調校能力&#xff0c;為用戶帶來了便捷的使用體驗。今天&#xff0c;就讓我們…

14. git remote

基本概述 git remote 的作用是&#xff1a;查看、添加、修改和刪除與本地倉庫關聯的遠程倉庫。 基本用法 1.查看遠程倉庫 git remote # 顯示所有關聯的遠程倉庫&#xff08;名稱&#xff09; git remote -v # 顯示所有關聯的遠程倉庫&a…

【spark-submit】--提交任務

Spark-submit spark-submit 是 Apache Spark 提供的用于提交 Spark 應用程序到集群的命令行工具。 基本語法 spark-submit [options] <app-jar> [app-arguments]常用參數說明 應用程序配置 --class <class-name>: 指定應用程序的主類&#xff08;對于 Java/Sc…

2025.4.10總結

今日記錄&#xff1a;今天提了兩個問題單&#xff0c;最近要關注一下產出了&#xff0c;上半年的考核如今還剩兩個月了&#xff0c;然后發現一同入職的同事&#xff0c;有的人進步得很快&#xff0c;得向優秀得同事看齊了&#xff0c;不然幾年過去&#xff0c;別人連升好幾年&a…

SvelteKit 最新中文文檔教程(18)—— 淺層路由和 Packaging

前言 Svelte&#xff0c;一個語法簡潔、入門容易&#xff0c;面向未來的前端框架。 從 Svelte 誕生之初&#xff0c;就備受開發者的喜愛&#xff0c;根據統計&#xff0c;從 2019 年到 2024 年&#xff0c;連續 6 年一直是開發者最感興趣的前端框架 No.1&#xff1a; Svelte …

Winform入門進階企業級開發示例:http接口數據清洗轉換、斷線續傳、mqtt數據傳輸實例詳解(附代碼資源下載)

場景 C#/Winform入門、進階、強化、擴展、知識體系完善等知識點學習、性能優化、源碼分析專欄分享: C#/Winform入門、進階、強化、擴展、知識體系完善等知識點學習、性能優化、源碼分析專欄分享_winform 強化學習-CSDN博客 如何將以上相關理論知識學以致用。下面針對Winform…

Python代碼縮進統一規范

一、Python縮進的重要性:邏輯與可讀性的橋梁 1. 語法規則的核心 Python與其他編程語言顯著不同之處在于,它使用縮進來表示代碼塊的層次結構。不像C、Java等語言依靠大括號{}來明確函數體、循環體和條件語句的范圍,Python完全依賴縮進來界定這些邏輯單元。例如,在一個if條…

asp.net core 項目發布到 IIS 服務器

目錄 一、VS2022 發布 二、設置IIS服務 三、配置IIS管理器 &#xff08;一&#xff09;打開IIS管理器 &#xff08;二&#xff09;添加站臺 &#xff08;三&#xff09;配置應用程式集區 四、安裝ASP.NET Core Hosting Bundle 五、設定IIS的日志位置 六、測試 一、VS2…