分类: SpringBoot
thumbnail

SpringBoot使用PageHelper实现分页功能

spring使用PageHelper https://www.tinstu.com/1282.html SpringBoot使用PageHelper实现分页功能 第一步: 导入依赖 <!--pagehelper--> <de……
thumbnail

SpringBoot:Profile功能

Profile功能 为了方便多环境适配,springboot简化了profile功能。 application-profile功能 默认配置文件 application.yaml;任何时候都会加载 指定环境配……
thumbnail

SpringBoot:指标监控

SpringBoot Actuator 简介 未来每一个微服务在云上部署以后,我们都需要对其进行监控、追踪、审计、控制等。SpringBoot就抽取了Actuator场景,使得我们每个……
thumbnail

SpringBoot:单元测试

JUnit5常用注解 JUnit5的注解与JUnit4的注解有所变化 https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations @Test :表示方法是测……
thumbnail

SpringBoot:NoSQL-Redis

RedisTemplate与Lettuce 自动配置: RedisAutoConfiguration 自动配置类。RedisProperties 属性类 --> spring.redis.xxx是对redis的配置 连接工厂是准备……
thumbnail

SpringBoot:SQL-MyBatis/MyBatisPlus

MyBatis 导入mybatis官方starter 编写mapper接口。标准@Mapper注解 编写sql映射文件并绑定mapper接口 在application.yaml中指定Mapper配置文件的位置,以及……
thumbnail

SpringBoot:SQL-HikariDataSource

1.数据源的自动配置HikariDataSource <dependency> <groupId>org.springframework.boot</groupId> <……
thumbnail

SpringBoot:Web原生组件的注入

1.使用Servlet API 在配置类中加入注解: @ServletComponentScan(basePackages = "com.tinstu") :指定原生Servlet组件都放在那里 新建servlet加入注解:@WebS……
thumbnail

SpringBoot:异常处理

错误处理 、默认规则 默认情况下,Spring Boot提供/error处理所有错误的映射 对于机器客户端,它将生成JSON响应,其中包含错误,HTTP状态和异常消息的详细……
thumbnail

SpringBoot:文件上传

页面表单 <form method="post" action="/upload" enctype="multipart/form-data"> <!--单文件--> <input type="file" name="headerI……
thumbnail

SpringBoot:拦截器

拦截器  登录检查与静态资源放行 在配置类中配置拦截器 /** * 1、编写一个拦截器实现HandlerInterceptor接口 * 2、拦截器注册到容器中(实现WebMvcConfigu……
thumbnail

SpringBoot:视图解析与模板引擎

视图解析 视图解析:SpringBoot默认不支持 JSP,需要引入第三方模板引擎技术实现页面渲染。 基本语法 1.表达式 2.字面量 文本值: 'one text' , 'Another……
thumbnail

SpringBoot:请求参数与基本注解

注解 @PathVariable @PathVariable:路径变量 (可以放到map中) @RequestHeader:获取请求头(可以放到map中) @ModelAttribute:获取request域属性 @Reques……
thumbnail

SpringBoot:请求参数处理

请求映射 REST使用与原理 RESTful的简介和小案例: SpringMVC:RESTful简介 SpringMVC:RESTFul案例 核心Filter;HiddenHttpMethodFilter 用法: 表单method=……
thumbnail

SpringBoot:web开发-静态资源配置

静态资源访问 静态资源目录 只要静态资源放在类路径下: called /static (or /public or /resources or /META-INF/resources 访问 : 当前项目根路径/ + 静……
thumbnail

SpringBoot:配置文件yaml

yaml 基本语法: key: value;kv之间有空格 大小写敏感 使用缩进表示层级关系 缩进不允许使用tab,只允许空格 缩进的空格数不重要,只要相同层级的元素左对……