成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

Springboot jdbctemplate整合實現(xiàn)步驟解析

瀏覽:3日期:2023-04-30 15:26:24

一、創(chuàng)建項目導(dǎo)入依賴

1.1

Springboot jdbctemplate整合實現(xiàn)步驟解析

1.2

Springboot jdbctemplate整合實現(xiàn)步驟解析

1.3

Springboot jdbctemplate整合實現(xiàn)步驟解析

二、創(chuàng)建service,pojo,controller

Springboot jdbctemplate整合實現(xiàn)步驟解析

2.1

創(chuàng)建一個實體類User類屬性userId,userName,userPwd

2.2

我這里sql語句直接寫service層了

Springboot jdbctemplate整合實現(xiàn)步驟解析

spring提供jdbctemplate的自動話配置,所以我們直接使用就好了,

jdbctemplate提供的增刪改都是update()方法

查詢所有query(),有倆種方法,

第一種RowMapper<User>是查詢數(shù)據(jù)庫字段和類的屬性名不一致的情況

第二種BeanPropertyRowMapper就是數(shù)據(jù)庫和類的屬性一致情況

Controller

Springboot jdbctemplate整合實現(xiàn)步驟解析

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Spring
相關(guān)文章: