![](https://img-blog.csdnimg.cn/20201127151330137.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Spring Boot
分享Spring Boot日常
常家壮
嘿嘿
展开
-
SpringBoot-快速搭建并快速验证是否可用
SpringBoot-快速搭建并快速验证是否可用原创 2022-08-21 19:52:37 · 2583 阅读 · 0 评论 -
SpringSchedule 定时任务框架使用步骤(基于SpringBoot)
在启动类上加上 @EnableScheduling注解,开启定时任务package com.lianxi;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.scheduling.annotation.EnableScheduling;@SpringBootA原创 2021-01-05 11:39:56 · 295 阅读 · 1 评论 -
SpringBoot+SpringDataJpa @Query之 JPQL使用书写模板(模糊查询and条件查询)
一些准备工作请看→ 依赖以及数据库数据Dao@Query中的查询语句表名和字段名直接写实体类的类名和属性名即可package com.lianxi.jpa.dao;import com.lianxi.jpa.pojo.User;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.JpaSpecificationExecutor;i原创 2021-01-02 18:25:41 · 967 阅读 · 1 评论 -
SpringBoot+SpringData-Redis 操作 Redis(CRUD) 模板代码
Spring Data Redis官网:http://projects.spring.io/spring-data-redis/这是spring整合的Redis框架十分简洁好用导入依赖导入SpringDataRedis依赖也会传递导入了SpringBoot基本依赖,为了演示基本操作我在测试类里操作,我引入了 text包<!--SpringDataRedis依赖我没有加版本号,这个一定要加上,除非你有springboot依赖--> <parent> &原创 2020-12-18 22:20:04 · 252 阅读 · 1 评论 -
IntelliJ IDEA 使用Thymeleaf没提示(解决方法)
我在页面中使用Thymeleaf的时候发现爆红或者不提示语法,如下就是解决方法在页面添加 如下命名空间<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">添加之后,idea 就有提示了...原创 2020-12-18 17:45:20 · 2515 阅读 · 1 评论 -
Thymeleaf中 th:text 语法案例
在templates目录下建立一个HTML文件thy1.html在templates目录下建立一个thy1.html文件<!DOCTYPE html><html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"><head> <meta charset="UTF-8"> <title> th:text </title></head><bod原创 2020-12-16 21:21:47 · 2870 阅读 · 0 评论 -
使用Thymeleaf环境准备
导包导包根据你实际情况添加,我这里是单独一个工程,我得导入一些其他的如果有sprigboot等基本依赖,直接引入Thymeleaf依赖即可 <dependencies><!-- thymeleaf--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spr原创 2020-12-16 20:58:24 · 247 阅读 · 0 评论 -
Thymeleaf关闭页面缓存配置
Thymeleaf默认会开启页面缓存,提高页面并发能力,但会导致我们修改页面不会立即被展现,所以关闭缓存会更快显示在配置文件中添加配置在 application.yml里添加#把thymeleaf 缓存关闭spring: thymeleaf: cache: false...原创 2020-12-09 20:43:19 · 1495 阅读 · 0 评论 -
SpringBoot自定义异常基本步骤模板
自定义异常处理继承你要自定义异常的类,例如我要对RuntimeException自定义异常简单代码模板:public class MyException extends RuntimeException { private int status; //状态码 public MyException( int status,String message) { super(message); this.status = status; }}支原创 2020-11-30 22:29:18 · 2086 阅读 · 0 评论 -
启动报错解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use
测试类和启动类包名要一致,就可以了!原创 2020-11-28 20:36:44 · 2202 阅读 · 0 评论 -
使用Spring提供的RestTemplate模板类出现,中文乱码问题,解决方法
学习springboot时在使用RestTemplate发送请求,返回的信息有中文乱码解决方法在启动类中添加如下代码: @Bean public RestTemplate restTemplate(){ RestTemplate restTemplate = new RestTemplate(); //设置中文编码 restTemplate.getMessageConverters().add(1,new StringHttpMessageCon原创 2020-11-20 17:10:39 · 2344 阅读 · 0 评论 -
分享一个log4j的配置文件
log4j.properties复制如下,命名为log4j.properties,放在resources目录下即可#log4j.rootCategory=INFO, CONSOLE debug info warn error fatallog4j.rootCategory=debug, CONSOLE# Set the enterprise logger category to FATAL and its only appender to CONSOLE.log4j原创 2020-11-18 08:21:44 · 1953 阅读 · 0 评论 -
SpringBoot中加载webjars/ 目录下,但webjars是什么?
在看springboot源码时候,看到了加载webjars目录下,我就好奇webjars是什么?,所以找了一下资料webjars介绍这里我引入了我查找资料时的话WebJars是将客户端(浏览器)资源(JavaScript,Css等)打成jar包文件,以对资源进行统一依赖管理。WebJars的jar包部署在Maven中央仓库上对于日常的web开发而言,像css、js、images、font等静态资源文件管理是非常的混乱的、比如jQuery、Bootstrap、Vue.js等,可能每个框架使用的原创 2020-11-16 15:31:11 · 655 阅读 · 0 评论 -
YAML的基本语法(SpringBoot官方建议的配置文件)
YAML 是什么?具体是什么我也说不上来!就拿它当一个配置文件来学习就好了!以下是它注意的地方大小写敏感使用缩进表示层级关系缩进不允许使用tab,只允许空格缩进的空格数不重要,只要相同层级的元素左对齐即可对空格及其严格语法# 为注释# 这个是注释内容普通写法csdn: https://www.csdn.net/对象#对象CSDN: id: weixin_44257023 age: 2行内写法#行内写法CSDN: {id: weixin_44257023原创 2020-10-13 12:17:57 · 2594 阅读 · 0 评论 -
SpringBoot中很好玩的一个banner启动控制台效果
先说一个网站:BootSchool我就那”佛祖“为例:复制好后,在你自己创建SpringBoot项目中找到resources文件:创建banner.txt文件banner.txt文件创建完后粘贴复制的banner即可最后运行就能看到结果了这个东西就图一乐,大家可以自己发挥...原创 2020-07-15 18:10:43 · 2399 阅读 · 0 评论 -
Spring Security安全框架中BCrypt强哈希加密算法使用
任何应用考虑到安全,绝不能明文的方式保存密码。密码应该通过某种方式进行加密。如今已有很多标准的算法比如SHA或者MD5再结合salt(盐)使用是一个不错的选择。废话不多说!直接开始SpringBoot 中提供了Spring Security:BCryptPasswordEncoder类,实现Spring的PasswordEncoder接口使用BCrypt强哈希方法来加密密码。第一步:p...原创 2019-11-15 16:33:00 · 970 阅读 · 0 评论