Spring配置文件和mybatis詳解
1.配置文件
1.1 概述
計(jì)算機(jī)配置文件:用于存儲(chǔ)系統(tǒng)、應(yīng)用程序的設(shè)置信息,通常以文本或結(jié)構(gòu)化數(shù)據(jù)格式(如JSON、XML、INI等)保存。其核心功能包括但不限于:
- 參數(shù)定制:允許用戶或管理員調(diào)整軟件或硬件的運(yùn)行參數(shù)
- 環(huán)境適配:根據(jù)不同設(shè)備或場(chǎng)景加載特定配置(如開發(fā)/生產(chǎn)環(huán)境)
- 持久化存儲(chǔ):確保重啟后設(shè)置仍生效
SpringBoot配置文件:SpringBoot支持多種類型的配置文件,常見的格式包括properties、yaml和yml,主要用于集中管理應(yīng)用程序的各種配置參數(shù),簡(jiǎn)化部署和開發(fā)過程中的環(huán)境切換
- YAML和YML本質(zhì)上是相同的文件格式,只是文件擴(kuò)展名的不同,兩者在功能和使用上沒有區(qū)別
1.2 properties
- properties配置文件是最早期的配置?件格式,也是創(chuàng)建SpringBoot項(xiàng)?默認(rèn)的配置?件
- 采用常見的鍵值對(duì)格式(key=value)
- 支持
#開頭的注釋
#應(yīng)用程序名稱 spring.application.name=configuration #應(yīng)用程序端口號(hào) server.port=8080 #數(shù)據(jù)庫(kù)連接信息 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=root
1.3 yml
- 采用鍵值對(duì)格式(key: value),冒號(hào)后必須有空格
- 數(shù)據(jù)序列化格式,通過縮進(jìn)表示層級(jí)關(guān)系
- 支持
#開頭的注釋
spring:
application:
#應(yīng)用程序名稱
name: configuration
#數(shù)據(jù)庫(kù)連接信息
datasource:
url: jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8&useSSL=false
username: root
password: root
#應(yīng)用程序端口號(hào)
server:
port: 80801.4 優(yōu)缺點(diǎn)對(duì)比
properties
- 優(yōu)點(diǎn):
- 語(yǔ)法簡(jiǎn)單直觀,采用key=value形式,適合初學(xué)者快速上手
- 與Java生態(tài)兼容性極強(qiáng)
- 缺點(diǎn):
- 缺乏層次結(jié)構(gòu),復(fù)雜配置時(shí)容易冗余。上述配置數(shù)據(jù)庫(kù)連接信息時(shí)spring.datasource前綴冗余
- 不支持?jǐn)?shù)據(jù)類型定義,所有值均為字符串,需手動(dòng)轉(zhuǎn)換
yml
- 優(yōu)點(diǎn):
- 層次化結(jié)構(gòu)清晰,通過縮進(jìn)表示層級(jí),適合復(fù)雜配置場(chǎng)景
- 支持?jǐn)?shù)據(jù)類型(如布爾值、數(shù)字),減少手動(dòng)類型轉(zhuǎn)換
- 缺點(diǎn):
- 格式錯(cuò)誤易導(dǎo)致解析失敗(容易忽略冒號(hào)后空格)
- 部分舊版工具鏈兼容性較差,需額外依賴解析庫(kù)
注:SpringBoot同時(shí)支持兩種格式,混合使用時(shí)若key重復(fù),properties優(yōu)先級(jí)高于yml
1.5 @Value注解
作用:是Spring框架提供了一個(gè)@Value注解(org.springframework.beans.factory.annotation.Value),用于將外部配置文件中的值注入到Spring管理的Bean中
示例:(properties和yml的讀取方式相同)
package org.example.configuration.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
public class Config {
@Value("${spring.application.name}")
private String applicationName;
@Value("${server.port}")
private Integer port;
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
public void print() {
System.out.println("applicationName=" + applicationName);
System.out.println("port=" + port);
System.out.println("url=" + url);
System.out.println("username=" + username);
System.out.println("password=" + password);
}
}
package org.example.configuration;
import org.example.configuration.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class ConfigurationApplication {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(ConfigurationApplication.class, args);
Config config = context.getBean(Config.class);
config.print();
}
}運(yùn)行結(jié)果:
applicationName=configuration
port=8080
url=jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8&useSSL=false
username=root
password=root
2.mybatis
2.1 概述
MyBatis是一款優(yōu)秀的持久層框架,支持自定義 SQL、存儲(chǔ)過程、高級(jí)映射以及多種配置方式。它消除了幾乎所有的JDBC代碼和參數(shù)的手動(dòng)設(shè)置以及結(jié)果集的檢索
- 支持存儲(chǔ)過程:指的是數(shù)據(jù)庫(kù)管理系統(tǒng)(DBMS)允許用戶創(chuàng)建、存儲(chǔ)和執(zhí)行存儲(chǔ)過程的能力。存儲(chǔ)過程是一組預(yù)編譯的SQL語(yǔ)句,存儲(chǔ)在數(shù)據(jù)庫(kù)中,可以被應(yīng)用程序調(diào)用執(zhí)行
- 支持高級(jí)映射:指通過配置或注解實(shí)現(xiàn)復(fù)雜SQL查詢結(jié)果與Java對(duì)象之間的靈活轉(zhuǎn)換。其核心目標(biāo)是簡(jiǎn)化數(shù)據(jù)庫(kù)關(guān)聯(lián)操作,提升開發(fā)效率
- 支持多種配置方式:mybatis支持注解和xml兩種配置方式

2.2 前置操作
引入依賴:Spring Web,Mybatis Framework,MySQL Driver,Lombok

在application.properties/yml中添加數(shù)據(jù)庫(kù)連接信息:
#應(yīng)用程序名稱 spring.application.name=configuration #應(yīng)用程序端口號(hào) server.port=8080 #數(shù)據(jù)庫(kù)連接信息 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=root #自動(dòng)駝峰轉(zhuǎn)換 mybatis.configuration.map-underscore-to-camel-case=true
spring:
application:
#應(yīng)用程序名稱
name: configuration
#數(shù)據(jù)庫(kù)連接信息
datasource:
url: jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8&useSSL=false
username: root
password: root
#應(yīng)用程序端口號(hào)
server:
port: 8080
mybatis:
configuration:
map-underscore-to-camel-case: true #自動(dòng)駝峰轉(zhuǎn)換SQL命名規(guī)范:采用下劃線分隔單詞(如order_detail)Java命名規(guī)范:大駝峰/小駝峰
2.3 注解
2.3.1 配置
- 1.創(chuàng)建一個(gè)接口,并使用 @Mapper注解 修飾
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BlogMapper {
//其他代碼
}@Mapper注解:允許開發(fā)者直接在接口方法上通過注解配置SQL語(yǔ)句,無需編寫XML映射文件。適用于簡(jiǎn)單SQL場(chǎng)景,能顯著減少配置量
- 2.初始化數(shù)據(jù)
create table blog (id int primary key auto_increment,name varchar(128),age int); insert into blog values (null,'劉備',30),(null,'關(guān)羽',28),(null,'張飛',25);
- 3.創(chuàng)建對(duì)應(yīng)實(shí)體類
import lombok.Data;
@Data
public class PersonInfo {
private Integer id;
private String name;
private Integer age;
public PersonInfo(Integer id, String name, Integer age) {
this.id = id;
this.name = name;
this.age = age;
}
public PersonInfo() {
}
}2.3.2 CRUD
import com.example.spring_mybatis.model.PersonInfo;
import org.apache.ibatis.annotations.*;
@Mapper
public interface BlogMapper {
@Select("select * from blog")
List<PersonInfo> getPersonInfoAll();
@Insert("insert into blog values (#{id},#{name},#{age})")
Integer addPerson(PersonInfo person);
@Update("update blog set name = #{name},age = #{age} where id = #{id}")
Integer updatePerson(PersonInfo personInfo);
@Delete("delete from blog where id = #{id}")
Integer deletePerson(Integer id);
}按住alt+insert,可在test目錄下生成以上方法的測(cè)試方法
import com.example.spring_mybatis.model.PersonInfo;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
@Slf4j
class BlogMapperTest {
private final BlogMapper blogMapper;
@Autowired
public BlogMapperTest(BlogMapper blogMapper) {
this.blogMapper = blogMapper;
}
@Test
void getPersonInfoAll() {
List<PersonInfo> personInfoAll = blogMapper.getPersonInfoAll();
log.info("查詢成功,personInfoAll:{}",personInfoAll.toString());
//查詢成功,personInfoAll:[PersonInfo(id=1, name=劉備, age=30),
//PersonInfo(id=2, name=關(guān)羽, age=28),
//PersonInfo(id=3, name=張飛, age=25)]
}
@Test
void addPerson() {
Integer ret = blogMapper.addPerson(new PersonInfo(null, "趙云", 25));
log.info("添加成功,影響行數(shù):{}",ret.toString());//添加成功,影響行數(shù):1
}
@Test
void updatePerson() {
Integer ret = blogMapper.updatePerson(new PersonInfo(1, "劉備", 35));
log.info("更新成功,影響行數(shù):{}",ret.toString());//更新成功,影響行數(shù):1
}
@Test
void deletePerson() {
Integer ret = blogMapper.deletePerson(4);
log.info("刪除成功,影響行數(shù):{}",ret.toString());//刪除成功,影響行數(shù):1
}
}2.3.3 @Param
作用:用于在Mapper接口方法中為形式參數(shù)指定名稱。當(dāng)方法有多個(gè)參數(shù)時(shí),通過該注解明確SQL中引用的參數(shù)名,避免依賴參數(shù)順序
@Mapper
public interface BlogMapper {
//@Param
@Update("update blog set name = #{name},age = #{age} where id = #{id}")
Integer updatePersonInfo(@Param("id") Integer userId,@Param("name") String userName,@Param("age") Integer userAge);
}@SpringBootTest
@Slf4j
class BlogMapperTest {
private final BlogMapper blogMapper;
@Autowired
public BlogMapperTest(BlogMapper blogMapper) {
this.blogMapper = blogMapper;
}
@Test
void updatePersonInfo() {
Integer ret = blogMapper.updatePersonInfo(1, "劉玄德", 30);
log.info("更新成功,影響行數(shù):{}",ret.toString());//更新成功,影響行數(shù):1
}
}
2.4 xml
2.4.1 配置
- 1.創(chuàng)建一個(gè)接口,并使用 @Mapper注解 修飾
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BlogXMLMapper {
//其他代碼
}
- 2.配置mybatis的xml文件路徑
mybatis: mapper-locations: classpath:mybatis/**Mapper.xml #配置mybatis的xml文件路徑 #標(biāo)識(shí)位于resources/mybatis路徑下任何以Mapper結(jié)尾的xml文件為mybatis的配置文件

- 3.在resources/mybatis路徑下創(chuàng)建以Mapper結(jié)尾的xml文件,并添加如下代碼
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!--namespace:用于指定該XML文件對(duì)應(yīng)的Java接口或類的全限定名--> <mapper namespace="com.example.spring_mybatis.mapper_blog.BlogXMLMapper"> </mapper>
2.4.2 示例
在接口中聲明方法
import com.example.spring_mybatis.model_blog.PersonInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BlogXMLMapper {
List<PersonInfo> getPersonInfoAll();
}在對(duì)應(yīng)xml文件中實(shí)現(xiàn)接口方法
- id:是MyBatis映射文件中SQL語(yǔ)句的唯一標(biāo)識(shí)符。需與Mapper接口中的方法名一致,保證映射正確
- resultType:指定SQL查詢結(jié)果映射的Java對(duì)象類型,需為全限定類名
<mapper namespace="com.example.spring_mybatis.mapper_blog.BlogXMLMapper">
<select id="getPersonInfoAll" resultType="com.example.spring_mybatis.model_blog.PersonInfo">
select * from blog
</select>
</mapper>按住alt+insert,可在test目錄下生成以上方法的測(cè)試方法
import com.example.spring_mybatis.model_blog.PersonInfo;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
@Slf4j
class BlogXMLMapperTest {
private final BlogXMLMapper blogXMLMapper;
@Autowired
public BlogXMLMapperTest(BlogXMLMapper blogXMLMapper) {
this.blogXMLMapper = blogXMLMapper;
}
@Test
void getPersonInfoAll() {
List<PersonInfo> personInfoAll = blogXMLMapper.getPersonInfoAll();
log.info("查詢成功,personInfoAll:{}",personInfoAll.toString());
}
}運(yùn)行結(jié)果:

2.5 動(dòng)態(tài)SQL
動(dòng)態(tài)SQL:指在程序運(yùn)行時(shí)根據(jù)條件或參數(shù)動(dòng)態(tài)生成的SQL語(yǔ)句。與靜態(tài)SQL相比,動(dòng)態(tài)SQL更具靈活性,適用于需要根據(jù)不同條件構(gòu)建查詢的場(chǎng)景。例如,在某些web/app進(jìn)行賬號(hào)注冊(cè)時(shí)會(huì)出現(xiàn)非必填選項(xiàng)
- mybatis的注解和xml兩種方式都能實(shí)現(xiàn)動(dòng)態(tài)SQL,但xml較為方便,所以下文使用xml來實(shí)現(xiàn)動(dòng)態(tài)SQL
2.5.1 trim標(biāo)簽
作用:用于自定義字符串截取規(guī)則。包含四個(gè)屬性:
- prefix:最終結(jié)果添加前綴
- suffix:最終結(jié)果添加后綴
- prefixOverrides:去除首部指定內(nèi)容
- suffixOverrides:去除尾部指定內(nèi)容
2.5.2 if標(biāo)簽
作用:用于條件判斷,通常在where或set語(yǔ)句中使用。當(dāng)test表達(dá)式的值為true時(shí),包含標(biāo)簽內(nèi)的SQL片段
<insert id="addPersonInfo">
insert into blog
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="age != null">
age,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="name != null">
#{name},
</if>
<if test="age != null">
#{age},
</if>
</trim>
</insert>2.5.3 where標(biāo)簽
作用:替代SQL中的where關(guān)鍵字。當(dāng)if條件成立時(shí)才會(huì)加入SQL片段,并自動(dòng)去除第一個(gè)子句的and/or
<select id="getPersonInfoByNameAndAge">
select * from blog
<where>
<if test="name != null">
and name = #{name}
</if>
<if test="age != null">
and age = #{age}
</if>
</where>
</select>2.5.4 set標(biāo)簽
作用:用于update語(yǔ)句。當(dāng)if條件成立時(shí)才會(huì)加入SQL片段,并自動(dòng)去除最后一個(gè)子句的逗號(hào)、
<update id="updatePersonInfo">
update blog
<set>
<if test="name != null">
name = #{name},
</if>
<if test="age != null">
age = #{age},
</if>
</set>
<where>
and id = #{id}
</where>
</update>2.5.5 foreach標(biāo)簽
作用:用于集合遍歷。主要屬性:
- collection:集合參數(shù)名
- item:當(dāng)前元素變量名
- open/close:包圍符號(hào)
- separator:分隔符
@Test
void getPersonInfoById() {
ArrayList<Integer> ids = new ArrayList<>();
ids.add(1);
ids.add(2);
ids.add(3);
List<PersonInfo> personInfoById = blogXMLMapper.getPersonInfoById(ids);
System.out.println(personInfoById);
} <select id="getPersonInfoById" resultType="com.example.spring_mybatis.model_blog.PersonInfo">
select * from blog
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>2.5.6 include標(biāo)簽
作用:用于引用SQL片段,通過refid指定要引用的片段id。需配合sql標(biāo)簽使用,實(shí)現(xiàn)代碼復(fù)用
<sql id="collection">
id,name,age
</sql>
<select id="getPersonInfoAll" resultType="com.example.spring_mybatis.model_blog.PersonInfo">
select
<include refid="collection">
</include>
from blog
</select>2.6 主鍵返回
主鍵返回:指在數(shù)據(jù)庫(kù)插入操作后,自動(dòng)獲取剛插入記錄的主鍵值。在mybatis中使用注解和xml都能獲取到返回的主鍵
1.注解實(shí)現(xiàn)
@Mapper
public interface BlogMapper {
@Options(useGeneratedKeys = true,keyProperty = "id")
@Insert("insert into blog values (#{id},#{name},#{age})")
Integer addPerson(PersonInfo person);
}
@SpringBootTest
@Slf4j
class BlogMapperTest {
private final BlogMapper blogMapper;
@Autowired
public BlogMapperTest(BlogMapper blogMapper) {
this.blogMapper = blogMapper;
}
@Test
void addPerson() {
PersonInfo personInfo = new PersonInfo(null, "黃忠", 60);
Integer ret = blogMapper.addPerson(personInfo);
log.info("添加成功,影響行數(shù):{},返回的主鍵值:{}",ret.toString(),personInfo.getId());//添加成功,影響行數(shù):1,返回的主鍵值:6
}
}
2.通過xml實(shí)現(xiàn)
@SpringBootTest
@Slf4j
class BlogXMLMapperTest {
private final BlogXMLMapper blogXMLMapper;
@Autowired
public BlogXMLMapperTest(BlogXMLMapper blogXMLMapper) {
this.blogXMLMapper = blogXMLMapper;
}
@Test
void addPersonInfo() {
PersonInfo personInfo = new PersonInfo();
personInfo.setAge(40);
personInfo.setName("曹操");
Integer ret = blogXMLMapper.addPersonInfo(personInfo);
log.info("添加成功,影響行數(shù):{},返回的主鍵值:{}",ret.toString(),personInfo.getId());//添加成功,影響行數(shù):1,返回的主鍵值:7
}
} <insert id="addPersonInfo" useGeneratedKeys="true" keyProperty="id">
insert into blog
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="age != null">
age,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="name != null">
#{name},
</if>
<if test="age != null">
#{age},
</if>
</trim>
</insert>
2.7 預(yù)編譯/即時(shí)SQL
預(yù)編譯SQL(Prepared Statements):SQL語(yǔ)句在程序運(yùn)行前被預(yù)先編譯并存儲(chǔ)在數(shù)據(jù)庫(kù)中。執(zhí)行時(shí)只需傳遞參數(shù),無需重新編譯SQL語(yǔ)句
- 安全性高:通過參數(shù)化查詢避免SQL注入攻擊。參數(shù)化查詢是一種將SQL語(yǔ)句與用戶輸入數(shù)據(jù)分離的數(shù)據(jù)庫(kù)操作方式,查詢語(yǔ)句中使用占位符(如?、@param等)代替直接拼接用戶輸入,執(zhí)行時(shí)通過預(yù)編譯機(jī)制將參數(shù)動(dòng)態(tài)綁定到占位符位置
- 性能優(yōu)化:編譯一次,多次執(zhí)行,減少數(shù)據(jù)庫(kù)開銷
即時(shí)SQL(Dynamic SQL):在程序運(yùn)行時(shí)動(dòng)態(tài)生成并立即編譯執(zhí)行,每次執(zhí)行都可能涉及完整的SQL解析和編譯過程
- 靈活性高:可根據(jù)運(yùn)行時(shí)條件動(dòng)態(tài)拼接SQL語(yǔ)句
- 潛在風(fēng)險(xiǎn):直接拼接用戶輸入可能導(dǎo)致SQL注入
- 性能開銷:每次執(zhí)行需重新編譯
#占位符會(huì)使用預(yù)編譯機(jī)制,將參數(shù)值安全地綁定到SQL語(yǔ)句中,防止SQL注入攻擊。MyBatis會(huì)將#替換為?,然后通過JDBC的預(yù)編譯功能設(shè)置參數(shù)值$占位符直接進(jìn)行字符串替換,將參數(shù)值拼接到SQL語(yǔ)句中,不會(huì)進(jìn)行預(yù)編譯或轉(zhuǎn)義處理
SQL注入攻擊:當(dāng)惡意輸入" 'or 1 = '1 "時(shí)
1.預(yù)編譯SQL
@Select("select * from blog where name= #{name}")
List<UserInfo> queryByName(String name)預(yù)編譯SQL會(huì)根據(jù)參數(shù)的類型判斷是否需要加引號(hào),上述name參數(shù)是String類型,需要加引號(hào),這就是參數(shù)化查詢的作用。最終SQL:
select * from blog where name = " 'or 1='1 "; # 整個(gè) 'or 1='1 會(huì)作為name的值
2.即時(shí)SQL
@Select("select * from blog where name= '${name}'")
List<UserInfo> queryByName(String name)即時(shí)SQL不會(huì)判斷參數(shù)類型從而是否添加引號(hào),所以需要手動(dòng)加上單引號(hào)。最終SQL:
select * from blog where name = ''or 1 = '1'; # 因?yàn)?=1是恒等式,所以該表的數(shù)據(jù)會(huì)被全部查詢出來,這就是SQL注入
到此這篇關(guān)于Spring配置文件和mybatis的文章就介紹到這了,更多相關(guān)Spring配置文件和mybatis內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MybatisPlus實(shí)現(xiàn)insertBatchSomeColumn進(jìn)行批量增加
本文主要介紹了MybatisPlus實(shí)現(xiàn)insertBatchSomeColumn進(jìn)行批量增加,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-03-03
Java 守護(hù)線程_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
Java語(yǔ)言機(jī)制是構(gòu)建在JVM的基礎(chǔ)之上的,意思是Java平臺(tái)把操作系統(tǒng)的底層給屏蔽起來,所以它可以在它自己的虛擬的平臺(tái)里面構(gòu)造出對(duì)自己有利的機(jī)制,而語(yǔ)言或者說平臺(tái)的設(shè)計(jì)者多多少少是收到Unix思想的影響,而守護(hù)線程機(jī)制又是對(duì)JVM這樣的平臺(tái)湊合,于是守護(hù)線程應(yīng)運(yùn)而生2017-05-05
java后端如何調(diào)用第三方接口(往header和body中的參數(shù)傳參)
這篇文章主要介紹了java后端如何調(diào)用第三方接口(往header和body中的參數(shù)傳參),具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-12-12
Java實(shí)現(xiàn)兩人五子棋游戲(三) 畫出棋子
這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)兩人五子棋游戲,畫出五子棋的棋子,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-03-03
SpringCloud網(wǎng)關(guān)(Zuul)如何給多個(gè)微服務(wù)之間傳遞共享參數(shù)
這篇文章主要介紹了SpringCloud網(wǎng)關(guān)(Zuul)如何給多個(gè)微服務(wù)之間傳遞共享參數(shù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-03-03
Java獲取當(dāng)前時(shí)間方法總結(jié)
本篇文章給大家整理了關(guān)于Java獲取當(dāng)前時(shí)間方法,以及相關(guān)代碼分享,有需要的朋友測(cè)試參考下吧。2018-02-02
使用MyBatis進(jìn)行數(shù)據(jù)庫(kù)映射的方式
這篇文章主要介紹了使用MyBatis進(jìn)行數(shù)據(jù)庫(kù)映射的方式,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-10-10
java數(shù)組實(shí)現(xiàn)循環(huán)隊(duì)列示例介紹
大家好,本篇文章主要講的是java數(shù)組實(shí)現(xiàn)循環(huán)隊(duì)列示例介紹,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽2022-01-01
Java調(diào)用opencv IDEA環(huán)境配置的教程詳解
這篇文章主要為大家詳細(xì)介紹了Java調(diào)用opencv IDEA環(huán)境配置的相關(guān)知識(shí),文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-03-03

