主頁 > 後端開發 > 2、spring+mybatis注解+idea+maven

2、spring+mybatis注解+idea+maven

2022-08-19 08:51:52 後端開發

1、在idea中配置database 連接資料庫,用來在idea中撰寫sql腳本操作資料庫

 

 

 

 

 

 

 

 

 2、sql詳細腳本如下:

 1 --1.創建部門表
 2 create table dept
 3  (
 4    deptno int(2) unsigned primary key,
 5    dname varchar(14),
 6    loc varchar(13)
 7  );
 8 
 9 --2.添加部門資料
10 insert into dept(deptno,dname,loc) values
11 (10,'ACCOUNTING','NEW YORK'),
12 (20,'RESEARCH','DALLAS'),
13 (30,'SALES','CHICAGO'),
14 (40,'OPERATIONS','BOSTON');
15 
16 --3.創建員工表
17 create table emp
18 (
19    empno int(4) unsigned primary key,
20    ename varchar(10),
21    job varchar(9),
22    mgr int(4),
23    hiredate date,
24    sal double(7,2),
25    comm double(7,2),
26    deptno int(2) references dept(deptno)
27 );
28 
29 --4.插入資料員工資料
30 insert into emp(empno,ename,job,mgr,hiredate,sal,comm,deptno) values
31 (7369,'SMITH','CLERK',7902,'1980-12-17',800,null,20),
32 (7499,'ALLEN','SALESMAN',7698,'1981-02-20',1600,300,30),
33 (7521,'WARD','SALESMAN',7698,'1981-02-22',1250,500,30),
34 (7566,'JONES','MANAGER',7839,'1981-04-02',2975,null,20),
35 (7654,'MARTIN','SALESMAN',7698,'1981-09-28',1250,1400,30),
36 (7698,'BLAKE','MANAGER',7839,'1981-05-01',2850,null,30),
37 (7782,'BLAKE','MANAGER',7839,'1981-06-09',2450,null,10),
38 (7788,'SCOTT','ANALYST',7566,'1987-04-19',3000,null,20),
39 (7839,'KING','PRESIDENT',null,'1981-11-17',5000,null,10),
40 (7844,'TURNER','SALESMAN',7698,'1981-09-08',1500,0,30),
41 (7876,'ADAMS','CLERK',7788,'1987-05-23',1100,null,20),
42 (7900,'JAMES','CLERK',7698,'1981-12-03',950,null,30),
43 (7902,'FORD','ANALYST',7566,'1981-12-03',3000,null,20),
44 (7934,'MILLER','CLERK',7782,'1982-01-23',1300,null,10);
45 
46 
47 --3.員工福利表
48 create table bonus
49 (
50   ename varchar(10),
51   job varchar(9),
52   sal double(7,2),
53   comm double(7,2)
54 );
55 
56 --4.工資等級表
57 create table salgrade
58 (
59    grade int(10),
60    losal double(7,2),
61    hisal double(7,2)
62 );
63 
64 --5.插入工資等級資訊
65 insert into salgrade(grade,losal,hisal) values
66 (1,700,1200),
67 (2,1201,1400),
68 (3,1401,2000),
69 (4,2001,3000),
70 (5,3001,9999);
scott-mysql.sql

3、創建專案,專案結構如下:

 

 

 

 4、在pojo包下創建MainEntity.java物體類

  1 package com.pojo;
  2 /**
  3  * 承接首頁資料的持久化類
  4  * 用來接受sql查詢的結果
  5  * 且將資料傳輸到首頁顯示
  6  */
  7 public class MainEntity {
  8     //因為多方外鍵列的值和一方主鍵列的值是一樣的,如果有需要則顯示多方外鍵列欄位,不寫一方主鍵列
  9     //先寫多方欄位
 10      private Integer empno;
 11      private String ename;
 12      private String job;
 13      private Double sal;
 14      private Integer deptno;
 15 
 16      private Double maxsal;
 17      private Double minsal;
 18     //再寫一方欄位
 19     private String dname;
 20 
 21     public MainEntity() {
 22     }
 23 
 24     public MainEntity(Integer empno, String ename, String job, Double sal, Integer deptno, String dname) {
 25         this.empno = empno;
 26         this.ename = ename;
 27         this.job = job;
 28         this.sal = sal;
 29         this.deptno = deptno;
 30         this.dname = dname;
 31     }
 32 
 33     public MainEntity(Integer empno, String ename, String job, Double sal, Integer deptno, String dname,  Double minsal,Double maxsal) {
 34         this.empno = empno;
 35         this.ename = ename;
 36         this.job = job;
 37         this.sal = sal;
 38         this.deptno = deptno;
 39         this.maxsal = maxsal;
 40         this.minsal = minsal;
 41         this.dname = dname;
 42     }
 43 
 44     public Integer getEmpno() {
 45         return empno;
 46     }
 47 
 48     public void setEmpno(Integer empno) {
 49         this.empno = empno;
 50     }
 51 
 52     public String getEname() {
 53         return ename;
 54     }
 55 
 56     public void setEname(String ename) {
 57         this.ename = ename;
 58     }
 59 
 60     public String getJob() {
 61         return job;
 62     }
 63 
 64     public void setJob(String job) {
 65         this.job = job;
 66     }
 67 
 68     public Double getSal() {
 69         return sal;
 70     }
 71 
 72     public void setSal(Double sal) {
 73         this.sal = sal;
 74     }
 75 
 76     public Integer getDeptno() {
 77         return deptno;
 78     }
 79 
 80     public void setDeptno(Integer deptno) {
 81         this.deptno = deptno;
 82     }
 83 
 84     public String getDname() {
 85         return dname;
 86     }
 87 
 88     public void setDname(String dname) {
 89         this.dname = dname;
 90     }
 91 
 92     public Double getMaxsal() {
 93         return maxsal;
 94     }
 95 
 96     public void setMaxsal(Double maxsal) {
 97         this.maxsal = maxsal;
 98     }
 99 
100     public Double getMinsal() {
101         return minsal;
102     }
103 
104     public void setMinsal(Double minsal) {
105         this.minsal = minsal;
106     }
107 
108     @Override
109     public String toString() {
110         return "MainEntity{" +
111                 "empno=" + empno +
112                 ", ename='" + ename + '\'' +
113                 ", job='" + job + '\'' +
114                 ", sal=" + sal +
115                 ", deptno=" + deptno +
116                 ", maxsal=" + maxsal +
117                 ", minsal=" + minsal +
118                 ", dname='" + dname + '\'' +
119                 '}';
120     }
121 }
MainEntity.java

5、在mapper包下創建MainEntityMapper.java映射介面

 1 package com.mapper;
 2 
 3 import com.pojo.MainEntity;
 4 import org.apache.ibatis.annotations.Delete;
 5 import org.apache.ibatis.annotations.Insert;
 6 import org.apache.ibatis.annotations.Select;
 7 import org.apache.ibatis.annotations.Update;
 8 
 9 import java.util.List;
10 
11 public interface MainEntityMapper {
12 //    mybatis注解的動態sql的要寫在script標簽內,且開始標簽前不能有空格
13     @Select("<script>" +
14             " select" +
15             "    d.dname," +
16             "    e.empno,e.ename,e.job,e.sal,e.deptno" +
17             " FROM" +
18             "     emp e, dept d" +
19             " where" +
20             "     e.deptno=d.deptno" +
21             " <if test='empno!=null'>  and e.empno=#{empno}  </if>" +
22             " <if test='ename!=null'>  and e.ename=#{ename}  </if>" +
23             " <if test='job!=null'>  and e.job=#{job}  </if>" +
24             " <if test='deptno!=null'>  and e.deptno=#{deptno}  </if>" +
25             " <if test='minsal!=null and maxsal!=null'> " +
26             "    and e.sal  between #{minsal}  and  #{maxsal} " +
27             " </if>" +
28             "</script>")
29     public List<MainEntity> selectData(MainEntity mainEntity);
30 
31 
32     @Select("select d.dname,e.empno,e.ename,e.job,e.sal,e.deptno  from emp e,dept d where e.deptno=d.deptno")
33     public List<MainEntity> selectMainData();
34 
35     @Select("select d.dname,e.empno,e.ename,e.job,e.sal,e.deptno  from emp e,dept d where e.deptno=d.deptno and e.empno=#{primarykey}")
36     public MainEntity selectByInfoData(Integer primarykey);
37 
38     @Insert("insert into emp(empno,ename,job,sal,deptno) values(#{empno},#{ename},#{job},#{sal},#{deptno})")
39     public int insertData(MainEntity mainEntity);
40 
41     @Update("update emp set ename=#{ename},job=#{job},sal=#{sal},deptno=#{deptno} where empno=#{empno}")
42     public int updateData(MainEntity mainEntity);
43 
44     @Delete("delete from emp where empno=#{primarykey}")
45     public int deleteData(Integer primarykey);
46 
47 }
MainEntityMapper.java

6、在service包下創建MainEntityService.java業務層介面

 1 package com.service;
 2 
 3 import com.pojo.MainEntity;
 4 import org.apache.ibatis.annotations.Delete;
 5 import org.apache.ibatis.annotations.Insert;
 6 import org.apache.ibatis.annotations.Select;
 7 import org.apache.ibatis.annotations.Update;
 8 
 9 import java.util.List;
10 
11 public interface MainEntityService {
12 
13     public List<MainEntity> show(MainEntity mainEntity);
14 
15     public int add(MainEntity mainEntity);
16 
17     public int edit(MainEntity mainEntity);
18 
19     public int del(Integer primarykey);
20 
21 }
MainEntityService.java

7、在service包下創建MainEntityServiceImpl.java業務層介面實作類

 1 package com.service;
 2 
 3 import com.mapper.MainEntityMapper;
 4 import com.pojo.MainEntity;
 5 
 6 import java.util.List;
 7 
 8 public class MainEntityServiceImpl implements MainEntityService {
 9     private MainEntityMapper mapper;
10 
11     public MainEntityMapper getMapper() {
12         return mapper;
13     }
14 
15     public void setMapper(MainEntityMapper mapper) {
16         this.mapper = mapper;
17     }
18 
19     @Override
20     public List<MainEntity> show(MainEntity mainEntity) {
21         return mapper.selectData(mainEntity);
22     }
23 
24     @Override
25     public int add(MainEntity mainEntity) {
26         return mapper.insertData(mainEntity);
27     }
28 
29     @Override
30     public int edit(MainEntity mainEntity) {
31         return mapper.updateData(mainEntity);
32     }
33 
34     @Override
35     public int del(Integer primarykey) {
36         return mapper.deleteData(primarykey);
37     }
38 }
MainEntityServiceImpl .java

8、在resouces下創建日志記錄檔案log4j.properties檔案

 1 log4j.rootLogger=DEBUG, Console  
 2 #Console  
 3 log4j.appender.Console=org.apache.log4j.ConsoleAppender  
 4 log4j.appender.Console.layout=org.apache.log4j.PatternLayout  
 5 log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n  
 6 
 7 log4j.logger.org.apache=INFO  
 8 log4j.logger.java.sql.ResultSet=INFO  
 9 log4j.logger.java.sql.Connection=DEBUG  
10 log4j.logger.java.sql.Statement=DEBUG  
11 log4j.logger.java.sql.PreparedStatement=DEBUG   
log4j.properties

9、在resouces下創建spring的applicationContext.xml檔案

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4        xmlns:aop="http://www.springframework.org/schema/aop"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xmlns:tx="http://www.springframework.org/schema/tx"
 7        xmlns:mvc="http://www.springframework.org/schema/mvc"
 8        xsi:schemaLocation="http://www.springframework.org/schema/beans
 9        http://www.springframework.org/schema/beans/spring-beans.xsd
10        http://www.springframework.org/schema/aop
11        http://www.springframework.org/schema/aop/spring-aop.xsd
12        http://www.springframework.org/schema/context
13        http://www.springframework.org/schema/context/spring-context.xsd
14        http://www.springframework.org/schema/tx
15        http://www.springframework.org/schema/tx/spring-tx.xsd
16        http://www.springframework.org/schema/mvc
17        http://www.springframework.org/schema/mvc/spring-mvc.xsd
18 ">
19     <!--1.驅動管理資料源-->
20     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
21         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
22         <property name="url" value="jdbc:mysql://localhost:3306/ar"/>
23         <property name="username" value="root"/>
24         <property name="password" value="123456"/>
25     </bean>
26    <!--2.資料源事務管理,注意id的必須是transactionManager-->
27     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
28         <property name="dataSource" ref="dataSource"/>
29     </bean>
30      <!--3.事務注解驅動-->
31     <tx:annotation-driven transaction-manager="transactionManager"/>
32      <!--4.sqlsessionfactorybean-->
33     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
34           <property name="dataSource" ref="dataSource"/>
35         <!--參考mybatis主組態檔的寫法-->
36           <!--<property name="configLocation" value="https://www.cnblogs.com/holly8/archive/2022/08/19/mybatisConfig.xml"/>-->
37 
38         <!--參考mybatis映射檔案的寫法-->
39         <!--<property name="mapperLocations" value="https://www.cnblogs.com/holly8/archive/2022/08/19/classpath:mapper/*.xml"/>-->
40 
41         <!--配置某個包下的類全路徑的別名-->
42         <!--<property name="typeAliasesPackage" value=""/>-->
43     </bean>
44 
45 
46     <!--5.SqlSessionTemplate-->
47     <!--采用構造注入-->
48     <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
49           <constructor-arg  ref="sqlSessionFactory"/>
50     </bean>
51 
52     <!--6.映射工廠bean,參考映射介面,底層代理會自動幫我們完成映射介面實作類的部分-->
53     <bean id="mainEntityMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
54          <property name="sqlSessionTemplate" ref="sqlSessionTemplate"/>
55          <property name="mapperInterface" value="com.mapper.MainEntityMapper"/>
56     </bean>
57 
58     <!--7.業務層service的實作類的構建-->
59     <bean id="mainEntityService" class="com.service.MainEntityServiceImpl">
60           <property name="mapper" ref="mainEntityMapper"/>
61     </bean>
62 </beans>
applicationContext.xml

10、在test包下創建MvvmTest.java測驗類

 1 package com.test;
 2 
 3 import com.pojo.MainEntity;
 4 import com.service.MainEntityService;
 5 import org.junit.Test;
 6 import org.springframework.context.ApplicationContext;
 7 import org.springframework.context.support.ClassPathXmlApplicationContext;
 8 
 9 import java.util.List;
10 
11 public class MvvmTest {
12     //加載spring的xml檔案
13     ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");
14     //在spring的xml檔案中獲取service的bean
15     MainEntityService service=(MainEntityService)ac.getBean("mainEntityService");
16 //   測驗查詢所有
17     @Test
18     public void selectAll(){
19        List<MainEntity> list= service.show(new MainEntity());
20         for (MainEntity m:list) {
21             System.out.println(m);
22         }
23     }
24 
25    @Test
26     public void selectData(){
27         MainEntity entity=new MainEntity();
28 //        entity.setEmpno(7788);
29 //        entity.setEname("SCOTT");
30 //        entity.setJob("ANALYST");
31 //        entity.setDeptno(10);
32         entity.setMinsal(800.00);
33         entity.setMaxsal(1300.00);
34 
35         List<MainEntity> list= service.show(entity);
36         for (MainEntity m:list) {
37             System.out.println(m);
38         }
39     }
40 
41 
42 
43     @Test
44     public void insertData(){
45         MainEntity entity=new MainEntity(1,"holly","教學",12.00,10,"xxx");
46         System.out.println(service.add(entity)>0?"add success":"add fail");
47     }
48     @Test
49     public void updateData(){
50         MainEntity entity=new MainEntity(1,"holly","教學",16.00,10,"xxx");
51         System.out.println(service.edit(entity)>0?"update success":"update fail");
52     }
53     @Test
54     public void deleteData(){
55         System.out.println(service.del(1)>0?"delete success":"delete fail");
56     }
57 
58 
59 }
MvvmTest .java

11、運行其中一個?

 

 

此文章為原創,轉載請注明出處!需要本案例原始碼,理論講解視頻,代碼操作視頻的,請私信聯系作者!

 

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/502272.html

標籤:其他

上一篇:2、spring+mybatis注解+idea+maven

下一篇:IOS OpenGL ES GPUImage 減法混合 GPUImageSubtractBlendFilter

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 【C++】Microsoft C++、C 和匯編程式檔案

    ......

    uj5u.com 2020-09-10 00:57:23 more
  • 例外宣告

    相比于斷言適用于排除邏輯上不可能存在的狀態,例外通常是用于邏輯上可能發生的錯誤。 例外宣告 Item 1:當函式不可能拋出例外或不能接受拋出例外時,使用noexcept 理由 如果不打算拋出例外的話,程式就會認為無法處理這種錯誤,并且應當盡早終止,如此可以有效地阻止例外的傳播與擴散。 示例 //不可 ......

    uj5u.com 2020-09-10 00:57:27 more
  • Codeforces 1400E Clear the Multiset(貪心 + 分治)

    鏈接:https://codeforces.com/problemset/problem/1400/E 來源:Codeforces 思路:給你一個陣列,現在你可以進行兩種操作,操作1:將一段沒有 0 的區間進行減一的操作,操作2:將 i 位置上的元素歸零。最終問:將這個陣列的全部元素歸零后操作的最少 ......

    uj5u.com 2020-09-10 00:57:30 more
  • UVA11610 【Reverse Prime】

    本人看到此題沒有翻譯,就附帶了一個自己的翻譯版本 思考 這一題,它的第一個要求是找出所有 $7$ 位反向質數及其質因數的個數。 我們應該需要質數篩篩選1~$10^{7}$的所有數,這里就不慢慢介紹了。但是,重讀題,我們突然發現反向質數都是 $7$ 位,而將它反過來后的數字卻是 $6$ 位數,這就說明 ......

    uj5u.com 2020-09-10 00:57:36 more
  • 統計區間素數數量

    1 #pragma GCC optimize(2) 2 #include <bits/stdc++.h> 3 using namespace std; 4 bool isprime[1000000010]; 5 vector<int> prime; 6 inline int getlist(int ......

    uj5u.com 2020-09-10 00:57:47 more
  • C/C++編程筆記:C++中的 const 變數詳解,教你正確認識const用法

    1、C中的const 1、區域const變數存放在堆疊區中,會分配記憶體(也就是說可以通過地址間接修改變數的值)。測驗代碼如下: 運行結果: 2、全域const變數存放在只讀資料段(不能通過地址修改,會發生寫入錯誤), 默認為外部聯編,可以給其他源檔案使用(需要用extern關鍵字修飾) 運行結果: ......

    uj5u.com 2020-09-10 00:58:04 more
  • 【C++犯錯記錄】VS2019 MFC添加資源不懂如何修改資源宏ID

    1. 首先在資源視圖中,添加資源 2. 點擊新添加的資源,復制自動生成的ID 3. 在解決方案資源管理器中找到Resource.h檔案,編輯,使用整個專案搜索和替換的方式快速替換 宏宣告 4. Ctrl+Shift+F 全域搜索,點擊查找全部,然后逐個替換 5. 為什么使用搜索替換而不使用屬性視窗直 ......

    uj5u.com 2020-09-10 00:59:11 more
  • 【C++犯錯記錄】VS2019 MFC不懂的批量添加資源

    1. 打開資源頭檔案Resource.h,在其中預先定義好宏 ID(不清楚其實ID值應該設定多少,可以先新建一個相同的資源項,再在這個資源的ID值的基礎上遞增即可) 2. 在資源視圖中選中專案資源,按F7編輯資源檔案,按 ID 型別 相對路徑的形式添加 資源。(別忘了先把檔案拷貝到專案中的res檔案 ......

    uj5u.com 2020-09-10 01:00:19 more
  • C/C++編程筆記:關于C++的參考型別,專供新手入門使用

    今天要講的是C++中我最喜歡的一個用法——參考,也叫別名。 參考就是給一個變數名取一個變數名,方便我們間接地使用這個變數。我們可以給一個變數創建N個參考,這N + 1個變數共享了同一塊記憶體區域。(參考型別的變數會占用記憶體空間,占用的記憶體空間的大小和指標型別的大小是相同的。雖然參考是一個物件的別名,但 ......

    uj5u.com 2020-09-10 01:00:22 more
  • 【C/C++編程筆記】從頭開始學習C ++:初學者完整指南

    眾所周知,C ++的學習曲線陡峭,但是花時間學習這種語言將為您的職業帶來奇跡,并使您與其他開發人員區分開。您會更輕松地學習新語言,形成真正的解決問題的技能,并在編程的基礎上打下堅實的基礎。 C ++將幫助您養成良好的編程習慣(即清晰一致的編碼風格,在撰寫代碼時注釋代碼,并限制類內部的可見性),并且由 ......

    uj5u.com 2020-09-10 01:00:41 more
最新发布
  • Rust中的智能指標:Box<T> Rc<T> Arc<T> Cell<T> RefCell<T> Weak

    Rust中的智能指標是什么 智能指標(smart pointers)是一類資料結構,是擁有資料所有權和額外功能的指標。是指標的進一步發展 指標(pointer)是一個包含記憶體地址的變數的通用概念。這個地址參考,或 ” 指向”(points at)一些其 他資料 。參考以 & 符號為標志并借用了他們所 ......

    uj5u.com 2023-04-20 07:24:10 more
  • Java的值傳遞和參考傳遞

    值傳遞不會改變本身,參考傳遞(如果傳遞的值需要實體化到堆里)如果發生修改了會改變本身。 1.基本資料型別都是值傳遞 package com.example.basic; public class Test { public static void main(String[] args) { int ......

    uj5u.com 2023-04-20 07:24:04 more
  • [2]SpinalHDL教程——Scala簡單入門

    第一個 Scala 程式 shell里面輸入 $ scala scala> 1 + 1 res0: Int = 2 scala> println("Hello World!") Hello World! 檔案形式 object HelloWorld { /* 這是我的第一個 Scala 程式 * 以 ......

    uj5u.com 2023-04-20 07:23:58 more
  • 理解函式指標和回呼函式

    理解 函式指標 指向函式的指標。比如: 理解函式指標的偽代碼 void (*p)(int type, char *data); // 定義一個函式指標p void func(int type, char *data); // 宣告一個函式func p = func; // 將指標p指向函式func ......

    uj5u.com 2023-04-20 07:23:52 more
  • Django筆記二十五之資料庫函式之日期函式

    本文首發于公眾號:Hunter后端 原文鏈接:Django筆記二十五之資料庫函式之日期函式 日期函式主要介紹兩個大類,Extract() 和 Trunc() Extract() 函式作用是提取日期,比如我們可以提取一個日期欄位的年份,月份,日等資料 Trunc() 的作用則是截取,比如 2022-0 ......

    uj5u.com 2023-04-20 07:23:45 more
  • 一天吃透JVM面試八股文

    什么是JVM? JVM,全稱Java Virtual Machine(Java虛擬機),是通過在實際的計算機上仿真模擬各種計算機功能來實作的。由一套位元組碼指令集、一組暫存器、一個堆疊、一個垃圾回收堆和一個存盤方法域等組成。JVM屏蔽了與作業系統平臺相關的資訊,使得Java程式只需要生成在Java虛擬機 ......

    uj5u.com 2023-04-20 07:23:31 more
  • 使用Java接入小程式訂閱訊息!

    更新完微信服務號的模板訊息之后,我又趕緊把微信小程式的訂閱訊息給實作了!之前我一直以為微信小程式也是要企業才能申請,沒想到小程式個人就能申請。 訊息推送平臺🔥推送下發【郵件】【短信】【微信服務號】【微信小程式】【企業微信】【釘釘】等訊息型別。 https://gitee.com/zhongfuch ......

    uj5u.com 2023-04-20 07:22:59 more
  • java -- 緩沖流、轉換流、序列化流

    緩沖流 緩沖流, 也叫高效流, 按照資料型別分類: 位元組緩沖流:BufferedInputStream,BufferedOutputStream 字符緩沖流:BufferedReader,BufferedWriter 緩沖流的基本原理,是在創建流物件時,會創建一個內置的默認大小的緩沖區陣列,通過緩沖 ......

    uj5u.com 2023-04-20 07:22:49 more
  • Java-SpringBoot-Range請求頭設定實作視頻分段傳輸

    老實說,人太懶了,現在基本都不喜歡寫筆記了,但是網上有關Range請求頭的文章都太水了 下面是抄的一段StackOverflow的代碼...自己大修改過的,寫的注釋挺全的,應該直接看得懂,就不解釋了 寫的不好...只是希望能給視頻網站開發的新手一點點幫助吧. 業務場景:視頻分段傳輸、視頻多段傳輸(理 ......

    uj5u.com 2023-04-20 07:22:42 more
  • Windows 10開發教程_編程入門自學教程_菜鳥教程-免費教程分享

    教程簡介 Windows 10開發入門教程 - 從簡單的步驟了解Windows 10開發,從基本到高級概念,包括簡介,UWP,第一個應用程式,商店,XAML控制元件,資料系結,XAML性能,自適應設計,自適應UI,自適應代碼,檔案管理,SQLite資料庫,應用程式到應用程式通信,應用程式本地化,應用程式 ......

    uj5u.com 2023-04-20 07:22:35 more