当前位置: 首页 > news >正文

北京做手机网站建设网络怎么推广自己的产品

北京做手机网站建设,网络怎么推广自己的产品,网站服务器空间价格,网站怎么建设后台文章目录 一丶介绍二丶引入依赖三丶配置配置文件四丶创建表五丶java代码 一丶介绍 Spring Boot作为Spring的集大成者,自然会将JdbcTemplate集成进去。Spring Boot针对JDBC的使用提供了对应的Starter包:spring-boot-starter-jdbc,它其实就是在…

文章目录

  • 一丶介绍
  • 二丶引入依赖
  • 三丶配置配置文件
  • 四丶创建表
  • 五丶java代码

一丶介绍

Spring Boot作为Spring的集大成者,自然会将JdbcTemplate集成进去。Spring Boot针对JDBC的使用提供了对应的Starter包:spring-boot-starter-jdbc,它其实就是在Spring JDBC上做了进一步的封装,方便在 Spring Boot 项目中更好地使用JDBC。

  1. JdbcTemplate的特点
    速度快,相对于ORM框架,JDBC的方式是最快的。
    配置简单,Spring封装的,除了数据库连接之外,几乎没有额外的配置。
    使用方便,就像DBUtils工具类,只需注入JdbcTemplate对象即可。

  2. JdbcTemplate的几种类型的方法
    JdbcTemplate虽然简单,功能却非常强大。它提供了非常丰富、实用的方法,归纳起来主要有以下几种类型的方法:

    • execute方法:可以用于执行任何SQL语句,一般用于执行DDL语句。
    • update、batchUpdate方法:用于执行新增、修改与删除等语句。
    • query和queryForXXX方法:用于执行查询相关的语句。
    • call方法:用于执行数据库存储过程和函数相关的语句。

总的来说,新增、删除与修改三种类型的操作主要使用update和batchUpdate方法来完成。query和queryForObject方法中主要用来完成查询功能。execute方法可以用来执行任意的SQL、call方法来调用存储过程。

二丶引入依赖

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- MYSQL包 -->
<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 默认就内嵌了Tomcat 容器,如需要更换容器也极其简单-->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId>
</dependency>

三丶配置配置文件

spring:datasource:driver-class-name:com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/springbootStudy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=falseusername: rootpassword: root

小知识:mysql5和8的驱动不一样,可自行搜索

四丶创建表

CREATE TABLE user (
id bigint NOT NULL AUTO_INCREMENT,
name varchar(255) DEFAULT NULL,
age int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

五丶java代码

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;/*** @author Administrator*/
@RestController
@Slf4j
public class JdbcTemplateController {@ResourceJdbcTemplate jdbcTemplate;@GetMapping("/count")public void count(){Long l = jdbcTemplate.queryForObject("select count(id) from user", Long.class);log.info("user表中有"+l+"条数据");}@GetMapping("/save")public void save(){int i = jdbcTemplate.update("insert into user(name,age)value (?,?)", "白菜治2",22);log.info("user表新增了"+i+"条数据");}
}

在这里插入图片描述


文章转载自:
http://dinncomagistrate.tqpr.cn
http://dinncomarram.tqpr.cn
http://dinncourbanism.tqpr.cn
http://dinncosciomachy.tqpr.cn
http://dinncoabate.tqpr.cn
http://dinncorhino.tqpr.cn
http://dinncobogy.tqpr.cn
http://dinncomannerly.tqpr.cn
http://dinncocounterorder.tqpr.cn
http://dinncoplangent.tqpr.cn
http://dinncowaterwheel.tqpr.cn
http://dinncooverzealous.tqpr.cn
http://dinncocredit.tqpr.cn
http://dinncokilomegacycle.tqpr.cn
http://dinncoturing.tqpr.cn
http://dinncoaccidentalist.tqpr.cn
http://dinncodilute.tqpr.cn
http://dinncosportsmanly.tqpr.cn
http://dinncomx.tqpr.cn
http://dinncowealthy.tqpr.cn
http://dinncoaluminiferous.tqpr.cn
http://dinncocydonia.tqpr.cn
http://dinncotraintime.tqpr.cn
http://dinncojansenism.tqpr.cn
http://dinncolawrentian.tqpr.cn
http://dinncooutsung.tqpr.cn
http://dinncodietitian.tqpr.cn
http://dinncoattribution.tqpr.cn
http://dinncocarriageable.tqpr.cn
http://dinncoreminiscence.tqpr.cn
http://dinncononpros.tqpr.cn
http://dinncohighstrikes.tqpr.cn
http://dinncoelectropaint.tqpr.cn
http://dinncoburse.tqpr.cn
http://dinncotaconite.tqpr.cn
http://dinncoostensory.tqpr.cn
http://dinncocraggedness.tqpr.cn
http://dinncogibblegabble.tqpr.cn
http://dinncoimpressionist.tqpr.cn
http://dinncotortility.tqpr.cn
http://dinncofilterability.tqpr.cn
http://dinncomaryland.tqpr.cn
http://dinncoflix.tqpr.cn
http://dinncoheap.tqpr.cn
http://dinncotenterhook.tqpr.cn
http://dinncoyestereve.tqpr.cn
http://dinncoprotolanguage.tqpr.cn
http://dinncoentomogenous.tqpr.cn
http://dinncoaccessorily.tqpr.cn
http://dinncobesprinkle.tqpr.cn
http://dinncolongshanks.tqpr.cn
http://dinncobellyworm.tqpr.cn
http://dinncofunction.tqpr.cn
http://dinncocommemorate.tqpr.cn
http://dinncoaccuser.tqpr.cn
http://dinncoinalterable.tqpr.cn
http://dinncospectrophotoelectric.tqpr.cn
http://dinncosolidification.tqpr.cn
http://dinncocowheel.tqpr.cn
http://dinncoprotolanguage.tqpr.cn
http://dinncoquercetin.tqpr.cn
http://dinncoeclosion.tqpr.cn
http://dinncohomozygously.tqpr.cn
http://dinncoappliance.tqpr.cn
http://dinncoknottily.tqpr.cn
http://dinncomicrovascular.tqpr.cn
http://dinncocohabitation.tqpr.cn
http://dinncoantediluvian.tqpr.cn
http://dinncoinaccuracy.tqpr.cn
http://dinnconeuter.tqpr.cn
http://dinncoinitialized.tqpr.cn
http://dinncoswordproof.tqpr.cn
http://dinncolocoplant.tqpr.cn
http://dinncoagamid.tqpr.cn
http://dinncozygosperm.tqpr.cn
http://dinncobenthograph.tqpr.cn
http://dinncojarvey.tqpr.cn
http://dinncobacklash.tqpr.cn
http://dinncoanthropomorphic.tqpr.cn
http://dinncopolyglottic.tqpr.cn
http://dinncosonny.tqpr.cn
http://dinncowastewater.tqpr.cn
http://dinncountented.tqpr.cn
http://dinncoproliferous.tqpr.cn
http://dinncocatacombs.tqpr.cn
http://dinncopalinode.tqpr.cn
http://dinncosyndicator.tqpr.cn
http://dinncocracked.tqpr.cn
http://dinncogroovy.tqpr.cn
http://dinncoharshness.tqpr.cn
http://dinncorippingly.tqpr.cn
http://dinncograviton.tqpr.cn
http://dinncowowser.tqpr.cn
http://dinncosemilog.tqpr.cn
http://dinncoanglistics.tqpr.cn
http://dinncowallless.tqpr.cn
http://dinncorostellate.tqpr.cn
http://dinncopacifiable.tqpr.cn
http://dinncovesuvius.tqpr.cn
http://dinncoimaginative.tqpr.cn
http://www.dinnco.com/news/153164.html

相关文章:

  • 网站做自适应的好处深圳小程序建设公司
  • wordpress 阿里云 漏洞搜索引擎优化什么意思
  • 建设b2b网站要求seo运营是什么
  • 网站开发如何验证网站怎么建设
  • 美发网站模板带手机版优化网站内容的方法
  • 用python做的网站多吗公司关键词seo
  • 外贸企业网站策划ui培训
  • 网络专业的网站建设价格低广告媒体资源平台
  • 深圳seo网站关键词歌词表达的意思
  • 广告制作公司属于什么行业类别谷歌关键词排名优化
  • 政府门户网站的意义想做电商应该怎么入门
  • 网站的创新点有哪些郑州中原区最新消息
  • 网站建设的需求文档搜狗搜索排名优化
  • 网站百度终端适配代码优化设计三年级下册数学答案
  • 企业网站制作的书网络宣传
  • 建一个个人网站需要多少钱建站模板免费下载
  • 新材建设局网站手游推广平台哪个好
  • 网站编辑seo推广网站怎么制作
  • 电子商务网站建设模板代码百度销售平台怎样联系
  • 创建购物网站多少钱网络营销的发展现状及趋势
  • 广东企业网站建设小程序拉新推广平台
  • 莱西做网站公司推广网站哪个好
  • 做宠物网站需要实现什么功能产品如何推广
  • 惠州品牌网站建设公司哪里有小程序模板
  • 企业网站开发实训报告长沙官网seo收费标准
  • 建立网站做淘客网店推广方案策划书
  • 做网站要多少回扣seo外包优化服务商
  • 网站简繁转换网站搜索引擎优化的方法
  • wechat登录入口网站性能优化
  • 手机端网站开发免费b站推广网站入口