随笔分类 -  springBoot

摘要:swagger+jwt+shiro+redis 一、前言 最近在项目中想整合swagger+jwt+shiro+redis过程中遇到诸多问题和困难,现重新写一个demo并记录解决步骤。 存在的问题: shiro默认的拦截跳转都是跳转url页面,而前后端分离后,后端并无权干涉页面跳转。 shiro默认 阅读全文
posted @ 2020-11-02 01:01 Maple_XL 阅读(713) 评论(0) 推荐(0)
摘要:SpringBoot与消息 消息概述 大多应用中,可通过消息服务中间件来提升系统异步通信、扩展解耦能力 消息服务中两个重要概念: ​ 消息代理(message broker)和目的地(destination) 当消息发送者发送消息以后,将由消息代理接管,消息代理保证消息传递到指定目的地。 消息队列主 阅读全文
posted @ 2020-07-07 23:25 Maple_XL 阅读(162) 评论(0) 推荐(0)
摘要:缓存 JSR107 Java Caching定义了5个核心接口,分别是CachingProvider, CacheManager, Cache, Entry 和 Expiry。 •CachingProvider定义了创建、配置、获取、管理和控制多个CacheManager。一个应用可以在运行期访问多 阅读全文
posted @ 2020-07-07 18:32 Maple_XL 阅读(395) 评论(0) 推荐(0)
摘要:异步、定时、邮件任务 异步任务 1、创建一个service包 2、创建一个类AsyncService 异步处理是非常常用的,比如我们在网站上发送邮件,后台会去发送邮件,此时前台会造成响应不动,直到邮件发送完毕,响应才会成功,所以我们一般会采用多线程的方式去处理这些任务。 编写方法,假装正在处理数据, 阅读全文
posted @ 2020-07-07 18:30 Maple_XL 阅读(155) 评论(0) 推荐(0)
摘要:springBoot整合Ridis SpringBoot 操作数据:spring-data jpa jdbc mongodb redis! SpringData 也是和 SpringBoot 齐名的项目! 说明: 在 SpringBoot2.x 之后,原来使用的jedis 被替换为了 lettuce 阅读全文
posted @ 2020-07-07 18:27 Maple_XL 阅读(165) 评论(0) 推荐(0)
摘要:SpringBoot整合Swagger2 Swagger 号称世界上最流行的API框架 Restful Api 文档在线自动生成器 ⇒ API 文档 与API 定义同步更新 直接运行,在线测试API 支持多种语言 (如:Java,PHP等) 官网:https://swagger.io/ Spring 阅读全文
posted @ 2020-07-07 18:26 Maple_XL 阅读(226) 评论(0) 推荐(0)
摘要:SpringBoot整合Shiro 1.shiro是什么? Shiro是Apache下的一个开源项目。shiro属于轻量级框架,相对于SpringSecurity简单的多,也没有SpringSecurity那么复杂。 2.主要功能 shiro主要有三大功能模块: Subject:主体,一般指用户。 阅读全文
posted @ 2020-07-07 18:23 Maple_XL 阅读(305) 评论(0) 推荐(0)
摘要:SpringBoot整合SpringSecurity 1. 认识SpringSecurity Spring Security 是针对Spring项目的安全框架,也是Spring Boot底层安全模块默认的技术选型,他可以实现强大的Web安全控制,对于安全控制,我们仅需要引入spring-boot-s 阅读全文
posted @ 2020-07-07 18:18 Maple_XL 阅读(798) 评论(0) 推荐(0)
摘要:自定义starter starter: ​ 1、这个场景需要使用到的依赖是什么? ​ 2、如何编写自动配置 @Configuration //指定这个类是一个配置类 @ConditionalOnXXX //在指定条件成立的情况下自动配置类生效 @AutoConfigureAfter //指定自动配置 阅读全文
posted @ 2020-07-07 18:16 Maple_XL 阅读(175) 评论(0) 推荐(0)
摘要:SpringBoot与数据访问 1、JDBC <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <depen 阅读全文
posted @ 2020-07-07 18:15 Maple_XL 阅读(437) 评论(0) 推荐(0)
摘要:配置嵌入式Servlet容器 SpringBoot默认使用Tomcat作为嵌入式的Servlet容器; 问题? 1)、如何定制和修改Servlet容器的相关配置; 1、修改和server有关的配置(ServerProperties【也是EmbeddedServletContainerCustomiz 阅读全文
posted @ 2020-07-07 18:07 Maple_XL 阅读(1085) 评论(0) 推荐(0)
摘要:错误处理机制 1)、SpringBoot默认的错误处理机制 默认效果: ​ 1)、浏览器,返回一个默认的错误页面 浏览器发送请求的请求头: ​ 2)、如果是其他客户端,默认响应一个json数据 ​ 原理: ​ 可以参照ErrorMvcAutoConfiguration;错误处理的自动配置; 给容器中 阅读全文
posted @ 2020-07-07 17:59 Maple_XL 阅读(245) 评论(0) 推荐(0)
摘要:SpringMVC自动配置 https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications 1. Spring MVC aut 阅读全文
posted @ 2020-07-07 17:52 Maple_XL 阅读(421) 评论(0) 推荐(0)
摘要:模板引擎 JSP、Velocity、Freemarker、Thymeleaf SpringBoot推荐的Thymeleaf; 语法更简单,功能更强大; 1、引入thymeleaf; <dependency> <groupId>org.springframework.boot</groupId> <a 阅读全文
posted @ 2020-07-07 17:50 Maple_XL 阅读(168) 评论(0) 推荐(0)
摘要:SpringBoot对静态资源的映射规则 @ConfigurationProperties(prefix = "spring.resources", ignoreUnknownFields = false) public class ResourceProperties implements Res 阅读全文
posted @ 2020-07-07 17:48 Maple_XL 阅读(627) 评论(0) 推荐(0)
摘要:SpringBoot运行原理初探 pom.xml 父依赖 直接父依赖主要管理项目的资源过滤及插件! <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifac 阅读全文
posted @ 2020-06-20 23:30 Maple_XL 阅读(160) 评论(0) 推荐(0)
摘要:SpringBoot简介 Spring是如何简化Java开发的 为了降低Java开发的复杂性,Spring采用了以下4种关键策略: 基于POJO的轻量级和最小侵入性编程,所有东西都是bean 通过IOC,依赖注入(DI)和面向接口实现松耦合 基于切面(AOP)和惯例进行声明式编程; 通过切面和模版减 阅读全文
posted @ 2020-06-17 17:38 Maple_XL 阅读(451) 评论(0) 推荐(0)