SpringBoot整合SpringMVC--JDBC--mybatis

Springboot项目整合mybatis、springmvc、JDBC 常用注解 @Configuration 标识当前类是配置类 @ComponentScan 包扫描注解 扫描注解 @Bean 标识该方法的返回值交给Spring容器管理 @Scope 控制多例和单例 @Lazy 懒加载 @PostConstruct 初始化方法 @PreDestroy 销毁方法 @Component 将当前类未来的对象交给容器管理 @Autowired 按照类型进行注入 @Qualifier 按照名称进行注入 @Repository 标识持久层注解 @Service 标识Service层 @C 阅读详情

1前一篇案例已经能实现mvc自动配置,这里我们主要解决以下3个问题

整合MVC

修改端口

查看SpringBoot的全局属性可知,端口通过以下方式配置:修改application。.properties在这里插入图片描述在这里插入图片描述

访问静态资源

ResourceProperties的类,里面就定义了静态资源的默认查找路径:
在这里插入图片描述
默认的静态资源路径为:
classpath:/META-INF/resources/
classpath:/resources/
classpath:/static/
classpath:/public
只要静态资源放在这些目录中任何一个,SpringMVC都会帮我们处理。
我们习惯会把静态资源放在 classpath:/static/ 目录下。我们创建目录,并且添加一些静态资源:

在这里插入图片描述
重启项目后测试:
在这里插入图片描述

添加拦截器

拦截器也是我们经常需要使用的,在SpringBoot中该如何配置呢?
首先我们定义一个拦截器:

public class LoginInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object
handler) {
logger.debug("处理器执行前执行!");
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object
handler, ModelAndView modelAndView) {
logger.debug("处理器执行后执行!");
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object
handler, Exception ex) {
logger.debug("跳转后执行!");
}
}

通过实现 WebMvcConfigurer 并添加 @Configuration 注解来实现自定义部分SpringMvc配置:

@Configuration
public class MvcConfig implements WebMvcConfigurer{
/**
* 通过@Bean注解,将我们定义的拦截器注册到Spring容器
* @return
*/
@Bean
public LoginInterceptor loginInterceptor(){
return new LoginInterceptor();
}
/**
* 重写接口中的addInterceptors方法,添加自定义拦截器
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 通过registry来注册拦截器,通过addPathPatterns来添加拦截路径
registry.addInterceptor(this.loginInterceptor()).addPathPatterns("/**");
}
}

ant path路径匹配通配符
‘?’ 匹配任何单字符
‘’ 匹配0或者任意数量的字符
‘/**’ 匹配0或者更多的目录
在这里插入图片描述
接下来运行并查看日志:
你会发现日志中什么都没有,因为我们记录的log级别是debug,默认是显示info以上,我们需要进行配置。
SpringBoot通过 logging.level.
=debug 来配置日志级别,*填写包名

# 设置com.lxs包的日志级别为debug
logging.level.com.lxs=debug

再次运行查看:
在这里插入图片描述

整合JDBC

导入资料中的t_user.sql文件,稍后源码将会放在我的资源中,读者可自行下载,无需积分
引入依赖
spring整合jdbc不需要原来的德鲁伊连接池,需要删掉

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

当然,不要忘了数据库驱动,SpringBoot并不知道我们用的什么数据库,这里我们选择MySQL:

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>

配置连接池
其实,在刚才引入jdbc启动器的时候,SpringBoot已经自动帮我们引入了一个连接池:
在这里插入图片描述
HikariCP应该是目前速度最快的连接池了,我们看看它与c3p0的对比:
在这里插入图片描述
因此,我们只需要指定连接池参数即可:

# 连接四大参数
spring.datasource.url=jdbc:mysql://localhost:3306/springboot
spring.datasource.username=root
spring.datasource.password=123
# 可省略,SpringBoot自动推断
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.hikari.idle-timeout=60000
spring.datasource.hikari.maximum-pool-size=30
spring.datasource.hikari.minimum-idle=10

实体类

public class User implements Serializable {
private Long id;
// 用户名
//自动转换下换线到驼峰命名user_name -> userName
private String userName;
// 密码
private String password;
// 姓名
private String name;
// 年龄
private Integer age;
// 性别,1男性,2女性
private Integer sex;
// 出生日期
private Date birthday;
// 创建时间
private Date created;
// 更新时间
private Date updated;
// 备注
private String note;

dao

@Repository
public class JdbcDao {
@Autowired
private JdbcTemplate jdbcTemplate;
public List<User> findAll() {
return jdbcTemplate.query("select * from tb_user", new BeanPropertyRowMapper<>
(User.class));
}
}

测试

@RunWith(SpringRunner.class)
@SpringBootTest
public class JdbcDaoTest {
@Autowired
private JdbcDao jdbcDao;
@Test
public void findAll() {
List<User> list = jdbcDao.findAll();
for (User user : list) {
System.out.println(user);
}
}
}

这里要注意
在这里插入图片描述
在这里插入图片描述

这两个类要放一起,不然会出错,博主解决了两小时。上面是两种方法

整合mybatis

SpringBoot官方并没有提供Mybatis的启动器,不过Mybatis官网自己实现了:

<!--mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>

配置,基本没有需要配置的:

# mybatis 别名扫描
mybatis.type-aliases-package=com.lxs.domain
# mapper.xml文件位置,如果没有映射文件,请注释掉
mybatis.mapper-locations=classpath:mappers/*.xml

实体类,直接使用jdbc用到的实体类

public class User {
private Long id;
// 用户名
//自动转换下换线到驼峰命名user_name -> userName
private String userName;
// 密码
private String password;
// 姓名
private String name;
// 年龄
private Integer age;
// 性别,1男性,2女性
private Integer sex;
// 出生日期
private Date birthday;
// 创建时间
private Date created;
// 更新时间
private Date updated;
// 备注
private String note;
//getter和setter方法

接口

public interface UserDao {
public List<User> findAll();
}

映射文件

<?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">
<mapper namespace="com.lxs.demo.dao.UserDao">
<select id="findAll" resultType="user">
select * from tb_user
</select>
</mapper>

Mapper的加载接口代理对象方式有2种

第一种:使用@Mapper注解(不推荐)
需要注意,这里没有配置mapper接口扫描包,因此我们需要给每一个Mapper接口添加 @Mapper 注解,才能被识
别。

@Mapper
public interface UserDao {
}

在这里插入图片描述

然后生成测试方法 快速生成测试方法的按钮是 Ctrl shift T
可以看到快速声测的测试方法

第二种设置MapperScan,注解扫描的包(推荐)
@MapperScan(“dao所在的包”),自动搜索包中的接口,产生dao的代理对象

@SpringBootApplication
@MapperScan("com.lxs.demo.dao")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

测试
引入测试构建

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

测试代码

@RunWith(SpringRunner.class)
@SpringBootTest
public class UserDaoTest {
@Autowired
private UserDao userDao;
@Test
public void testFindAll() {
List<User> list = userDao.findAll();
}
}

通用mapper

概念

使用Mybatis时,最大的问题是,要写大量的重复SQL语句在xml文件中,除了特殊的业务逻辑SQL语句之外,还有大量结构类似的增删改查SQL。而且,当数据库表结构改动时,对应的所有SQL以及实体类都需要更改。这大量增加了程序员的负担。避免重复书写CRUD映射的框架有两个
通用mybatis(tk mybatis)
mybatis plus,通能更加强大,后面实战项目中讲解
通用Mapper的作者也为自己的插件编写了启动器,我们直接引入即可:

<!-- 通用mapper -->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>

实体类
tk mybatis 实体类使用的注解是jpa注解

@Table(name = "tb_user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// 用户名
private String userName;
....

注意事项:

  1. 默认表名=类名,字段名=属性名
  2. 表名可以使用 @Table(name = “tableName”) 进行指定
  3. @Column(name = “fieldName”) 指定
  4. 使用 @Transient 注解表示跟字段不进行映射
    不需要做任何配置就可以使用了。
@Mapper
public interface UserMapper extends tk.mybatis.mapper.common.Mapper<User>{
public List<User> findByUser(User user);
}

自定义映射文件

映射复杂方法 resources/mappers/UserMapper.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">
<mapper namespace="com.lxs.demo.dao.UserMapper">
<select id="findByUser" resultType="user">
SELECT
*
FROM
tb_user
<where>
<if test="name != null">
name like '%${name}%'
</if>
<if test="note != null">
and note like '%${note}%'
</if>
</where>
</select>
</mapper>

一旦继承了Mapper,继承的Mapper就拥有了Mapper所有的通用方法:
Select 方法: List select(T record); 说明:根据实体中的属性值进行查询,查询条件使用等号
方法: T selectByPrimaryKey(Object key); 说明:根据主键字段进行查询,方法参数必须包含完整的主键属性,
查询条件使用等号
方法: List selectAll(); 说明:查询全部结果,select(null)方法能达到同样的效果
方法: T selectOne(T record); 说明:根据实体中的属性进行查询,只能有一个返回值,有多个结果是抛出异
常,查询条件使用等号
方法: int selectCount(T record); 说明:根据实体中的属性查询总数,查询条件使用等号
Insert 方法: int insert(T record); 说明:保存一个实体,null的属性也会保存,不会使用数据库默认值
方法: int insertSelective(T record); 说明:保存一个实体,null的属性不会保存,会使用数据库默认值
Update 方法: int updateByPrimaryKey(T record); 说明:根据主键更新实体全部字段,null值会被更新
方法: int updateByPrimaryKeySelective(T record); 说明:根据主键更新属性不为null的值
Delete 方法: int delete(T record); 说明:根据实体属性作为条件进行删除,查询条件使用等号
方法: int deleteByPrimaryKey(Object key); 说明:根据主键字段进行删除,方法参数必须包含完整的主键属性
Example方法 方法: List selectByExample(Object example); 说明:根据Example条件进行查询 重点:这
个查询支持通过 Example 类指定查询列,通过 selectProperties 方法指定查询列
方法: int selectCountByExample(Object example); 说明:根据Example条件进行查询总数
方法: int updateByExample(@Param(“record”) T record, @Param(“example”) Object example); 说明:根据
Example条件更新实体 record 包含的全部属性,null值会被更新
方法: int updateByExampleSelective(@Param(“record”) T record, @Param(“example”) Object example); 说
明:根据Example条件更新实体 record 包含的不是null的属性值
方法: int deleteByExample(Object example); 说明:根据Example条件删除数据
注意要把MapperScan类改成tk-mybatis构件的类

import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@EnableConfigurationProperties
@MapperScan("com.lxs.demo.dao")
public class Application {

注意:必须使用tk mybatis的MapperScan
在这里插入图片描述

启动测试
测试类

@RunWith(SpringRunner.class)
@SpringBootTest
public class UserDaoTest {
@Autowired
private UserDao userDao;
@Test
public void testFindByUser() {
User condition = new User();
condition.setName("a");
List<User> list = userMapper.findByUser(condition);
for (User user : list) {
System.out.println(user);
}
}
@Test
public void testFindAll() {
List<User> list = userDao.selectAll();
for (User user : list) {
System.out.println(user);
}
}
@Test
public void testFindById() {
User user = userDao.selectByPrimaryKey(4);
System.out.println(user);
}
@Test
public void testFindByExample() {
Example example = new Example(User.class);
example.createCriteria().andLike("name", "%a%");
userMapper.selectByExample(example).forEach(user -> {
System.out.println(user);
});
}
@Test
public void testInsert() {
User user = new User();
user.setAge(18);
user.setBirthday(new Date());
user.setCreated(new Date());
user.setName("周星驰");
userDao.insert(user);
}
 @Test
    public void testByExample(){
        Example example=new Example(User.class);
        example.createCriteria().andLike("name","%冰%");
        mapper.selectByExample(example).forEach(user -> {
            System.out.println(user);
        });
    }
SpringBoot Spring MVC 这个注释的意思是,当调用这个方法的时候,会从一个名叫accountCache的缓存中查询,如果没有,则执行实际的方法(即查询数据库),并将执行的结果存入缓存中,否则返回缓存中的对象。作用:@responseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据,需要注意的是,在使用此注解之后不会再走视图处理器,而是直接将数据写入到输入流中,他的效果等同于通过response对象输出指定格式的数据。 阅读详情

相关推荐

超全!!snowboy语音唤醒(树莓派4b)

通过snowboy进行树莓派的语音唤醒

crimaster1024的博客 8733

SpringBoot & SpringMVC (详解)

MVC 是 Model View Controller 的缩写,它是软件⼯程中的⼀种软件架构模式,它把软件系统分 为模型、视图和控制器三个基本部分。Model(模型)是应⽤程序中⽤于处理应⽤程序数据逻辑的部分。通常模型对象负责在数据库中存取数据。View(视图)是应⽤程序中处理数据显示的部分。通常视图是依据模型数据创建的。Controller(控制器)是应⽤程序中处理⽤户交互的部分。通常控制器负责从视图读取数据, 控制⽤户输⼊,并向模型发送数据。

qq_45559559的博客 3597

Alphafold2/multimer本地安装避坑指南:从Conda环境配置到GPU加速实战

本文详细介绍了Alphafold2/multimer本地安装的全流程,从Conda环境配置到GPU加速实战,特别针对常见的报错处理提供了解决方案。通过硬件环境检查、依赖安装技巧、OpenMM补丁应用等步骤,帮助研究人员高效部署蛋白质结构预测工具,提升计算效率。

weixin_29309213的博客 116

Maven搭建Spring Boot JDBC

编写pom.xml添加依赖<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/mav

Vi的博客 3365

Simulink中通过MEX与MinGW实现C/C++结构体变量的高效导入

本文详细介绍了在Simulink中通过MEX工具链与MinGW编译器,高效导入C/C++结构体变量的完整流程。文章从需求背景出发,逐步讲解了MinGW环境配置、.h文件编写规范、核心导入命令Simulink.importExternalCTypes的使用,以及如何在MATLAB Function模块和总线创建器中调用自定义结构体,旨在实现模型与代码的无缝对齐,为后续仿真和代码生成奠定坚实基础。

weixin_29056781的博客 342

2025-08-19利用opencv检测图片中文字及图片的坐标

该代码实现了图片中中文文本的检测与位置计算功能。主要使用CnOcr库进行OCR识别,结合OpenCV和PIL库处理图像。功能包括:1)检测图片中的中文文本及位置坐标;2)计算每个文本的像素宽度和高度;3)在原图上绘制文本边界框并标注识别结果。代码通过put_chinese_text函数解决中文显示问题,最终输出各文本内容、坐标位置及尺寸信息。适用于需要获取图片中文字精确位置的应用场景。

m0_58149406的博客 394

Spring MVC 详解 (Spring Boot)

Spring MVC 详解 (Spring Boot)

yyhgo_的博客 6743

YOLOv5改进系列(4)——添加ECA注意力机制

手把手教你在YOLOv5中加入ECA注意力机制,文内含两种方法,小白也能看懂!

路人贾的博客 8546

Springboot 之 Springboot下的MVC

3.3 Spring Boot 下的 Spring MVC Spring Boot 下的 Spring MVC 和之前的 Spring MVC 使用基本是一样的,主要有以下注解: 3.3.1 @Controller Spring MVC 的注解,表名该类用于处理 http 请求 3.3.2 @RestController Spring 4 后新增注解,是@Controller 注解功能的增强是 @Controller 与@ResponseBody 的组合注解 。如果一个 Controller 类添加了@Re

shiyansama的博客 4128

11、硬件工程师笔试面试——IGBT(2025版本)

IGBT的应用展望与创新趋势表明,随着电子技术的不断发展,IGBT在各个领域都有广泛的应用,如高压电力系统、交通工具、电锅炉、太阳能和风能发电系统等。FS型IGBT(场终止型绝缘栅双极晶体管)在电力传输领域的应用中,通过其独特的设计和特性,有助于确保系统的稳定性和安全性。每种器件都有其独特的优势,能够满足电力传输系统中不同的技术要求。FS型IGBT通常具有正温度系数,这意味着随着温度的升高,导通压降的主要影响因素是载流子迁移率的降低以及集电极和发射极的接触电阻的增加,有助于在高温下维持稳定的性能。

XU157303764的博客 2671

学Simulink——基于高渗透率可再生能源微电网的逆变器系统场景实例:含高比例逆变型电源的微电网暂态稳定性分析

本文详细介绍了基于MATLAB/Simulink的高渗透率可再生能源微电网建模方法,重点分析含高比例逆变型电源的微电网暂态稳定性问题。通过构建包含光伏、风电、逆变器和电网等模块的系统模型,展示了从项目创建、模块搭建到控制策略实现的完整过程。文章特别提供了逆变器PQ控制算法和故障处理逻辑的代码示例,并介绍了仿真参数设置与结果分析方法。该模型能有效评估微电网在故障条件下的动态响应特性,为优化逆变器控制策略提供依据,对现代智能电网研究具有重要意义。

xiaoheshang_123的博客 140

springboot整合springmvc、jdbc、mybatis、tk-mybatis

springboot整合springmvc、jdbc 文章目录springboot整合springmvc、jdbc前言一、SpringBoot的特点?1. 添加父工程坐标2. 添加web启动器二、SpringBoot整合SpringMVC1. 修改端口2. 访问静态资源3. 添加拦截器三、SpringBoot整合jdbc1. 引入依赖2. 配置连接池3. 创建实体类4. 创建dao5. 测试 前言 springboot是spring快速开发脚手架,通过约定大于配置的方式,快速构建和启动spring项目 一

afoskosnv的博客 295

Opencv项目实战:20 单手识别数字0到5

今天要做的是单手识别数字0到5,通过在窗口展示,实时的展示相应的图片以及文字。在这里,我提供一下识别更多数字的方法(0-10)。首先最简便的是双手识别,完全不用更改代码,把图片处理好就行了;其次,就是按照最上面的那张图片,参数figureup是一个长度为5的列表[0,0,0,0,0],你可以参照着手势将其打印出来,然后将其用if条件判断。当然,在我们这边最常见的还是华北手势表示数字,大家按照自己的习惯来就行。

m0_62919535的博客 2876

SpringBoot整合SpringMvc、jdbc、事务、连接池、Mybatis、通用Mapper及添加拦截器

5.SpringBoot实践 接下来,我们来看看如何用SpringBoot来玩转以前的SSM,我们沿用之前讲解SSM用到的数据库tb_user和实体类User 5.1.整合SpringMVC 虽然默认配置已经可以使用SpringMVC了,不过我们有时候需要进行自定义配置。 日志级别控制: ``` logging: level: cn.itcast: debug org.springframework: debug 5.1.1.修改端口 查看SpringBoot的全局属性可知,端口通过

qq_41412253的博客 321

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

springboot整合ssm的pom文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-...

WCD128的博客 563

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

SpringBoot学习-02-整合篇:SpringBoot整合SpringMVC、JDBC、Mybatis、Tk-Myabtis、Thymeleaf以及Mybatis Plus

1.SpringBoot整合SpringMVC      之前的入门案例已经完成SpringMVC的自动配置,能够使用SpringMVC的功能,这里我们主要需要解决三个问题: 1. 修改端口 2. 静态资源 3. 拦截器配置 1.1 修改端口      编辑SpringBoot的全局配置文件application.properties: server.port=80      或者application.yml: server: port: 80 1.2 访问静态资源      Resource

lijinghua的博客 919

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

Springboot框架简介

1.1.什么是SpringBoot SpringBoot是Spring项目中的一个子工程,与我们所熟知的Spring-framework 同属于spring的产品: 我们可以看到下面的一段介绍: Takes an opinionated view of building production-ready Spring applications. Spring Boot favors convention over configuration and is designed to get you up a

qq_43652793的博客 4万+

springboot整合各种框架

1、SpringBoot:整合SpringMVC 整合SpringMVC只需要引入: spring-boot-starter-web启动器依赖。 说明: 虽然默认配置已经可以使用SpringMVC,不过我们有时候需要进行自定义配置。 1.1 日志控制 # 配置日志 logging: level: # debug-info-warn-error cn.it: debug 说明: logging.level: 是固定写法,说明下面是日志级别配置,日志相关其它配置也可...

qq_36116242的博客 5167

SpringBoot整合MVC Mybatis plus 最全thymeleaf讲解(保姆级讲解,带Java代码案例讲解)

1.整合SpringMVC 上篇文章已经能实现mvc自动配置,这里我们主要解决以下3个问题 修改端口 静态资源 拦截器配置 修改端口 查看SpringBoot的全局属性可知,端口通过以下方式配置: # 映射端口 server.port=80重启服务 访问静态资源 ResourceProperties的类,里面就定义了静态资源的默认查找路径: 默认的静态资源路径为: classpa...

想找我?: 【编程张无忌的个人空间-哔哩哔哩】 https://b23.tv/0yjNTt2 797

SpringBoot+SSM整合

1.SpringBoot环境准备 ①构建Maven工程 ②导入spring boot父工程 <!--继承SpringBoot的父工程--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent...

亲爱的瑶的博客 4031

SpringBoot整合SpringMVC

虽然默认配置已经可以使用SpringMVC了,不过我们有时候需要进行自定义配置。 1.1.1.修改端口 查看SpringBoot的全局属性可知,端口通过以下方式配置: # 映射端口 server.port=80 重启服务后测试: 1.1.2.访问静态资源 现在,我们的项目是一个jar工程,那么就没有webapp,我们的静态资源该放哪里呢? 回顾我们上面看的源码,有一个叫做ResourcePro...

凌晨安的博客 4245

JavaEE之微服务与分布式——springboot整合

目录 1.整合SpringMVC 修改端口 添加拦截器 2.整合jdbc 3.整合mybatis mybatis 通用mapper 启动测试 4.Thymeleaf 4.1 入门案例 编写接口 引入启动器 静态页面 测试 模板缓存 4.2 thymeleaf详解 表达式 表达式常见用法 常用th标签 基本用法 使用thymeleaf布局 5. Mybatis Plus 快速入门 常用注解 内置增删改查 分页 内置分页 自定义xml分页 pageHel

qq_36279562的博客 933

Spring Boot学习记录 03SpringBoot 整合其他框架

SpringBoot整合其他框架 SpringBoot 抛弃了传统 xml 配置文件,通过JavaBean形式进行配置。因此其他配置整合需要应用说明 整合SpringMVC SpringBoot 对 SpringMVC 的一些自动配置可以满足大部分需求,但也可以自定义配置类 并实现WebMvcConfigurer接口 进行配置 WebMvcConfigurer接口主要重写的方法 返回 方法 说明 void addInterceptors(InterceptorRegistry registr

柏竹的博客 662

SpringBoot的整合

整合目录lombok的应用1. lombok的作用:2. lombok是什么:3. 使用步骤:4. 实现:5. lombok的注解:SpringBoot整合SpringMVC静态资源SpringBoot整合SpringMVC拦截器1. 实现步骤:2. 代码实现:SpringBoot整合jdbc、事务和连接池1. 步骤:2. 代码:3. 整合连接池:SpringBoot整合MyBatis1. 步骤:2. 实现:3. 通用Mapper:步骤:实现:SpringBoot整合Junit1. 整合步骤:2. 代码:S

weixin_43795939的博客 487

SpringBoot实践——与其他框架或应用的整合

整合SpringMvc 虽然默认配置已经可以使用SpringMVC了,不过有时候需要自定义配置。 修改端口 server: port: 8081 访问静态资源 现在我们的项目是一个jar工程,那么就没有webapp,那么静态资源该放在哪? 在前面查看自动配置原理的时候看到有一个ResourceProperties的类,里面定义了静态资源的默认查找路径。 https://blog.csdn.n...

mashaokang1314的博客 983

快速上手Spring Boot应用

Spring Boot 文章目录Spring Boot1. 概述1.1 由来1.2 特征2. 入门程序2.1 通过maven工程方式创建2.2 直接通过IDEA创建3. SpringBoot配置3.1 概述3.2 Spring Boot的配置文件3.2.1 yml格式配置文件3.2.2 多配置切换3.3 Spring Boot属性注入3.3.1 @Value注入3.3.2 @ConfigurationProperties注入4. Spring Boot整合SpringMVC4.1 整合JSP4.2 整合Sp

Satellite_H的博客 1586
上一篇: Spring-Boot学习
下一篇: Spring-Cloud前言介绍
凌晨里的无聊人
博客等级 码龄8年 2320粉丝 206原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凌晨里的无聊人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值