随笔分类 -  SpringBoot

摘要:转载:https://blog.csdn.net/weixin_42236404/article/details/90758737 由于Springboot使用的是内置的tomcat,因此我们需要创建如下一个配置类,继承WebMvcConfigurer,重写其方法 addResourceHandle 阅读全文
posted @ 2020-07-08 22:20 64Byte 阅读(1373) 评论(0) 推荐(0)
摘要:设置一个结束时间,到规定的endTime之后自动结束,所以就需要我在项目中设定定时任务,在规定时间获取到到期的任务并将它们的状态设定为结束. 定时任务的几种实现方式 1、Java自带的java.util.Timer类,这个类允许你调度一个java.util.TimerTask任务, 使用这种方式可以 阅读全文
posted @ 2020-07-08 20:47 64Byte 阅读(162) 评论(0) 推荐(0)
摘要:SpringBoot整合redis 1、导入依赖, redis相关依赖 <!-- 配置使用redis启动器 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-dat 阅读全文
posted @ 2020-07-07 20:09 64Byte 阅读(537) 评论(0) 推荐(0)
摘要:1、加载依赖: MybatisPlus的依赖 (将mybatis、mybatis-spring的依赖去除) <!-- mybatisPlus的相关依赖, 不需要加载 mybatis-spring-boot-starter --> <dependency> <groupId>com.baomidou< 阅读全文
posted @ 2020-07-07 16:58 64Byte 阅读(164) 评论(0) 推荐(0)
摘要:1、 导入mybatis相关依赖 <!-- spring-boot mabatis依赖 不要使用1.0.0版本,因为1.0.0版本还不支持拦截器插件 --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>myb 阅读全文
posted @ 2020-07-07 16:47 64Byte 阅读(157) 评论(0) 推荐(1)
摘要:SpringBoot 声明式事务管理, 提供两个注解: @EnableTransactionManagement: 表示是否开启事务管理,( 默认开启事务管理, 不加) @Transactional: 表示某个方法是否进行事务管理,加在业务层的方法上, 这个方法出现异常(默认情况: 运行时异常进行回 阅读全文
posted @ 2020-07-07 16:38 64Byte 阅读(416) 评论(0) 推荐(0)
摘要:Spring提供了spring-jdbc: 对jdbc的轻量级的封装, 提供一个一个JdbcTemplate类操作数据 1、导入jdbc启动器 starter <dependency> <groupId>org.springframework.boot</groupId> <artifactId>s 阅读全文
posted @ 2020-07-07 16:27 64Byte 阅读(2056) 评论(0) 推荐(0)
摘要:1、要求打包方式一定为war包 2、要求jsp页面放在webapp目录下, war才有, jar 没有 3、导入jsp相关的依赖 <!-- jsp相关的依赖: jstl, jsp, tomcat --> <dependency> <groupId>jstl</groupId> <artifactId 阅读全文
posted @ 2020-07-06 20:15 64Byte 阅读(219) 评论(0) 推荐(0)
摘要:过滤器是拦截所有请求 拦截器是拦截在进入到前端控制器之后的请求 过滤器 第一种方式: 利用Servlet3.0的WebFilter注解配置(推荐) @WebFilter是Servlet3.0新增加的注解,在servlet3.0之前,我们需要在web.xml文件中进行过滤器的配置, 而现在可以通过此注 阅读全文
posted @ 2020-07-06 20:05 64Byte 阅读(5175) 评论(2) 推荐(1)
摘要:SpringBoot默认使用的 commons-logging 日志框架, 默认的日志输出级别: info 使用commons-logging 配置文件对日志的配置: //只需要在配置文件中更改默认值 //设置日志输出级别为debug Debug=true //日志文件名,比如:suke.log,或 阅读全文
posted @ 2020-07-06 19:32 64Byte 阅读(1291) 评论(0) 推荐(0)
摘要:thymeleaf官网:https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#introducing-thymeleaf thymeleaf介绍 Thymeleaf是一个跟Velocity,FreeMarker类似的模板引擎, 阅读全文
posted @ 2020-07-06 19:09 64Byte 阅读(498) 评论(0) 推荐(0)
摘要:项目开发中的dev、test、prod是什么意思 开发环境(dev):开发环境是程序猿们专门用于开发的服务器,配置可以比较随意,为了开发调试方便,一般打开全部错误报告。 测试环境(test):一般是克隆一份生产环境的配置,一个程序在测试环境工作不正常,那么肯定不能把它发布到生产机上。 生产环境(pr 阅读全文
posted @ 2020-07-04 14:07 64Byte 阅读(2150) 评论(0) 推荐(0)
摘要:1、热部署 修改完代码,想让SpringBoot自动加载我们修改的内容(pom.xml添加依赖) <!-- spring-boot的开发工具,可以在修改代码时,不需要手动重启服务器 --> <dependency> <groupId>org.springframework.boot</groupId 阅读全文
posted @ 2020-07-04 11:45 64Byte 阅读(1589) 评论(0) 推荐(0)
摘要:SpringBoot启动类: @SpringBootApplication public class SpringBootDemo1Application { public static void main(String[] args) { SpringApplication.run(SpringB 阅读全文
posted @ 2020-07-04 10:21 64Byte 阅读(1254) 评论(0) 推荐(0)
摘要:Spring-tool-suite的下载:https://spring.io/tools SpringBoot简介 SpringBoot是整个Spring技术栈的整合,来简化Spring应用开发,约定大于配置,去繁从简,just run 就能创建一个独立的,产品级别的应用。 解决: "Spring全 阅读全文
posted @ 2020-07-03 20:40 64Byte 阅读(252) 评论(0) 推荐(0)