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

wordpress样板超级优化大师下载

wordpress样板,超级优化大师下载,wordpress 主页 慢,c2c模式平台有哪些目录 JdbcTemplate#xff08;操作数据库-查询返回值#xff09; 1.创建数据库 2.创建实体类 3.创建dao层 4.创建service层 5.创建测试类#xff1a; 6.xml配置 7.测试结果#xff1a; 8.结构示意#xff1a; JdbcTemplate#xff08;操作数据库-查询返回值…目录 JdbcTemplate操作数据库-查询返回值 1.创建数据库 2.创建实体类 3.创建dao层 4.创建service层 5.创建测试类 6.xml配置 7.测试结果 8.结构示意 JdbcTemplate操作数据库-查询返回值 1.创建数据库 数据库中有3条记录数据库名是user_db数据库表是t_book 2.创建实体类 实体类属性对应数据库每一条记录 package org.example.spring.entity;public class Book {private String userId;private String username;public String getUserId() {return userId;}public void setUserId(String userId) {this.userId userId;}public String getUsername() {return username;}public void setUsername(String username) {this.username username;}}3.创建dao层 抽象类 package org.example.spring.dao;import org.example.spring.entity.Book;public interface BookDao {//查询的方法int selectCount(); }实现类 package org.example.spring.dao;import org.example.spring.entity.Book; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository;Repository public class BookDaoImpl implements BookDao{//注入jdbcTemplate对象Autowiredprivate JdbcTemplate jdbcTemplate;// 查询Overridepublic int selectCount() {String sqlselect count(*) from t_book; // 此方法有两个参数//一个参数是sql一个参数是根据返回值类型而定如果是String类型就返回String类型是Int类型就返回Int类型Integer count jdbcTemplate.queryForObject(sql, Integer.class);return count;} }4.创建service层 package org.example.spring.service;import org.example.spring.dao.BookDao; import org.example.spring.entity.Book; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;Service public class BookService {//注入daoAutowiredprivate BookDao bookDao;//查询表中的记录数public int findCount(){return bookDao.selectCount();}}5.创建测试类 package org.example.spring.test;import org.example.spring.entity.Book; import org.example.spring.service.BookService; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;public class TestBook {Testpublic void test01(){ApplicationContext contextnew ClassPathXmlApplicationContext(bean1.xml);BookService bookService context.getBean(bookService, BookService.class);// 查询返回某个值int count bookService.findCount(); // 做输出System.out.println(count);}}6.xml配置 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxmlns:aophttp://www.springframework.org/schema/aopxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd!-- 开启组件扫描--context:component-scan base-packageorg.example/context:component-scan !--数据库连接池--bean iddataSource classcom.alibaba.druid.pool.DruidDataSource destroy-methodcloseproperty nameurl valuejdbc:mysql://localhost:3306/user_db?useSSLfalseamp;useUnicodetrueamp;characterEncodingUTF-8/property nameusername valueroot/property namepassword valuesise/property namedriverClassName valuecom.mysql.jdbc.Driver//bean!-- 创建jdbcTemplate对象--bean idjdbcTemplate classorg.springframework.jdbc.core.JdbcTemplate !--需要注入数据源信息--property namedataSource refdataSource/property/bean /beans 7.测试结果 8.结构示意
http://www.zqtcl.cn/news/764781/

相关文章:

  • 网站策划书包括哪些内容百度官方营销推广平台有哪些
  • 成都企业网站seo重庆企业网站推广费用
  • 广东电白建设集团有限公司网站wordpress 静态地址
  • 微网站和手机站区别工业设计专业学什么
  • 兰州网站建设哪里好素材图片高清
  • 公司网站建设进度设计官网登录入口
  • 中牟高端网站建设wordpress可视化文章
  • 那家公司做网站广西网络营销外包公司
  • 成品网站速成网站知名网站建设加盟合作
  • 零基础学pytho 网站开发Drupal对比WordPress
  • 网站开发 例子快影
  • 宁津建设局网站推介网站
  • c 是用来做网站的吗中国营销策划网
  • 在建设部网站首页莒县网页设计
  • 河北省城乡和住房建设厅网站网店代运营托管
  • 彩票网站建设wordpress判断用户权限
  • 简洁大气企业网站源码h5商城网站建设是什么
  • 河间做网站价格wordpress评论导出
  • 网站关键词布局图网站推广与宣传怎么做
  • 小说类网站程序西安移动网站建设
  • 贵州高端网站建设网站做好了怎么做后台
  • 网站建设与管理 答案国外做免费的视频网站有哪些
  • 网站建设电脑端手机端企业网站建设需求调研表
  • 怎么做游戏网站google国际版
  • 学校网站建设发展规划线上推广的渠道有哪些
  • 公主岭网站建设seo网站推广技术
  • 网站建设一次crm管理
  • 电商网站设计公司优选亿企邦wordpress管理员头像
  • 医院做网站需要多少钱wordpress 模板 设计
  • 建设网站的规则建设公司网站的原则