摘要:
解决方案 使用数据库连接池初始化连接资源 将sql语句抽取放在xml配置文件中 使用反射、内省等底层技术,自动将实体和表进行属性和字段的自动映射 阅读全文
posted @ 2025-01-10 23:49
ysd666
阅读(8)
评论(0)
推荐(0)
摘要:
SSM = springmvc + spring + mybatis 组合框架的一员,是一种持久层框架 持久层主要是完成与数据库的相关操作,数据库访问对象(Data Access Object),所以也称为DAO层 框架是一个半成品的软件,需要我们遵守对应的规范去完成开发工作 框架类型 框架作用 典 阅读全文
posted @ 2025-01-10 23:48
ysd666
阅读(22)
评论(0)
推荐(0)
摘要:
5.4 SpringBoot整合Redis 5.4.1 添加redis的起步依赖 org.springframework.boot spring-boot-starter-data-redis 1 2 3 4 5 5.4.2 配置redis的连接信息 #Redis spring.redis.host 阅读全文
posted @ 2025-01-10 23:48
ysd666
阅读(9)
评论(0)
推荐(0)
摘要:
5.2 SpringBoot整合Junit 5.2.1 添加Junit的起步依赖 org.springframework.boot spring-boot-starter-test test 1 2 3 4 5 6 5.2.2 编写测试类 package com.itheima.test; impo 阅读全文
posted @ 2025-01-10 23:44
ysd666
阅读(18)
评论(0)
推荐(0)
摘要:
5.1.7 配置Mapper映射文件 在src\main\resources\mapper路径下加入UserMapper.xml配置文件" 1 2 3 4 5 6 7 5.1.8 在application.properties中添加mybatis的信息 #spring集成Mybatis环境 #poj 阅读全文
posted @ 2025-01-10 23:43
ysd666
阅读(15)
评论(0)
推荐(0)
摘要:
5.1.4 创建user表 在test数据库中创建user表 -- Table structure for user DROP TABLE IF EXISTS user; CREATE TABLE user ( id int(11) NOT NULL AUTO_INCREMENT, username 阅读全文
posted @ 2025-01-10 23:43
ysd666
阅读(21)
评论(0)
推荐(0)
摘要:
五、SpringBoot与整合其他技术 5.1 SpringBoot整合Mybatis 5.1.1 添加Mybatis的起步依赖 org.mybatis.spring.boot mybatis-spring-boot-starter 1.1.1 1 2 3 4 5 6 5.1.2 添加数据库驱动坐标 阅读全文
posted @ 2025-01-10 23:42
ysd666
阅读(9)
评论(0)
推荐(0)
摘要:
4.2 配置文件与配置类的属性映射方式 4.2.1 使用注解@Value映射 我们可以通过@Value注解将配置文件中的值映射到一个Spring管理的Bean的字段上 例如: application.properties配置如下: person: name: zhangsan age: 18 1 2 阅读全文
posted @ 2025-01-10 23:42
ysd666
阅读(12)
评论(0)
推荐(0)
摘要:
4.1.2.2.2 配置Map数据 同上面的对象写法 4.1.2.2.3 配置数组(List、Set)数据 语法: key: - value1 - value2 或者: key: [value1,value2] 示例代码: city: beijing tianjin shanghai 阅读全文
posted @ 2025-01-10 23:41
ysd666
阅读(20)
评论(0)
推荐(0)
摘要:
4.1.2.2 yml配置文件的语法 4.1.2.2.1 配置普通数据 语法: key: value 示例代码: name: haohao 1 注意:value之前有一个空格 4.1.2.2.2 配置对象数据 语法: key: key1: value1 key2: value2 或者 阅读全文
posted @ 2025-01-10 23:40
ysd666
阅读(21)
评论(0)
推荐(0)

浙公网安备 33010602011771号