随笔分类 -  Spring Boot

摘要:1.@SpringBootConfiguration注解 @Configuratin注解是Spring框架提供的,表示当前类是一个配置类。 @SpringBootConfiguration注解和 @Configuratin注解都是标识一个可以被组件扫描器扫描的配置类, 只不过@SpringBootC 阅读全文
posted @ 2020-01-12 08:04 红尘年少 阅读(830) 评论(0) 推荐(2) 编辑
摘要:本篇博客基于https://www.cnblogs.com/my-program-life/p/12076474.html 一、自定义用户访问控制 1、在SecurityConfig类中重写configure(HttpSecurity http)方法 @Override protected void 阅读全文
posted @ 2020-01-01 17:31 红尘年少 阅读(2580) 评论(4) 推荐(0) 编辑
摘要:问题:出现UserRePository注入创建失败,一定先检查所有的@注解是否已经标记 问题发现:entity下的实体类上面没有加注解 任何基于hibernate的实体类一定要加上@Entity注解! 阅读全文
posted @ 2019-12-22 10:50 红尘年少 阅读(13276) 评论(0) 推荐(0) 编辑
摘要:具体代码地址 https://gitee.com/chuzhuyong/HandleSafer 自定义用户认证 通过自定义WebSecurityConfigurerAdapter类型的Bean组件,并重写configure(Authentication ManagerBuilder auth)方法, 阅读全文
posted @ 2019-12-21 14:11 红尘年少 阅读(4513) 评论(0) 推荐(0) 编辑
摘要:本篇随笔基于https://www.cnblogs.com/my-program-life/p/12067789.html实现 自定义RedisTemplate 一、创建自定义配置类RedisConfig package com.uos.cache.config; import com.faster 阅读全文
posted @ 2019-12-19 17:33 红尘年少 阅读(686) 评论(0) 推荐(0) 编辑
摘要:本篇随笔基于https://www.cnblogs.com/my-program-life/p/12067656.html 实现 一、使用Redis API进行业务数据缓存管理 在service下新建ApiCommentService,删除原有的CommentService package com. 阅读全文
posted @ 2019-12-19 16:35 红尘年少 阅读(706) 评论(0) 推荐(0) 编辑
摘要:一、添加Spring Data Redis依赖启动器 <!--Spring Data Redis 依赖启动器--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-dat 阅读全文
posted @ 2019-12-19 14:36 红尘年少 阅读(3256) 评论(0) 推荐(0) 编辑
摘要:项目结构 一、准备数据 创建数据库并创建表 二、在domain下新建City类 package com.uos.springboot.domain; import java.io.Serializable; /** * 城市实体类 */ public class City implements Se 阅读全文
posted @ 2019-12-17 11:31 红尘年少 阅读(1116) 评论(0) 推荐(0) 编辑
摘要:发送纯文本邮件 一、在pom.xml中添加邮件服务的依赖启动器 <!--邮件服务依赖启动器--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifa 阅读全文
posted @ 2019-12-16 11:18 红尘年少 阅读(675) 评论(0) 推荐(1) 编辑
摘要:一、添加ScheduledTaskService服务类 package com.uos.schedule.service; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.s 阅读全文
posted @ 2019-12-16 09:43 红尘年少 阅读(1419) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/my-program-life/p/12047396.html Spring Boot任务管理之无返回值异步任务调用 一、在OwnAsynService基础上添加 package com.uos.schedule.service; import org 阅读全文
posted @ 2019-12-16 09:28 红尘年少 阅读(586) 评论(1) 推荐(0) 编辑
摘要:一、service层 package com.uos.schedule.service; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; /* 阅读全文
posted @ 2019-12-16 09:16 红尘年少 阅读(508) 评论(0) 推荐(0) 编辑
摘要:项目结构 一、创建Spring Boot项目,引入Thymeleaf依赖 二、编写配置文件application.properties # thymeleaf页面缓存设置(默认为true),开发中方便调试应设置为false,上线稳定后应保持默认true spring.thymeleaf.cache= 阅读全文
posted @ 2019-12-15 10:31 红尘年少 阅读(629) 评论(0) 推荐(0) 编辑
摘要:项目结构 一、添加Spring Data JPA依赖启动器 另外,添加MySQL数据库依赖 <!--spring data jpa依赖启动器--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- 阅读全文
posted @ 2019-12-13 11:13 红尘年少 阅读(298) 评论(2) 推荐(0) 编辑
摘要:项目结构 一、添加Redis依赖 <!--redis依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <vers 阅读全文
posted @ 2019-12-12 16:52 红尘年少 阅读(278) 评论(0) 推荐(0) 编辑
摘要:pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2019-12-12 14:15 红尘年少 阅读(706) 评论(0) 推荐(0) 编辑
摘要:一、数据准备 创建数据库 CREATE DATABASE springbootdata DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 创建表t_article并插入相关数据 CREATE TABLE `t_article` ( `id` in 阅读全文
posted @ 2019-12-12 13:16 红尘年少 阅读(844) 评论(5) 推荐(0) 编辑
摘要:<dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>org.webjars</ 阅读全文
posted @ 2019-12-10 21:29 红尘年少 阅读(6456) 评论(0) 推荐(2) 编辑
摘要:1.清空缓存 左上角点击“File” >“Invalidate Caches / Restart” 弹出对话框,点击“Invalidate”。 2、左上角点击“File” >Project Structure 阅读全文
posted @ 2019-12-10 21:12 红尘年少 阅读(11625) 评论(0) 推荐(1) 编辑
摘要: 阅读全文
posted @ 2019-11-29 16:05 红尘年少 阅读(434) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示