
spring整合shiro
* principal : 主角* credentials : 证书ps : 整合过程中有大量的配置,我直接贴代码说明一:配置(一)在发动机(web.xml)中配置过滤器shiro是权限控制是通过filter来实现的,所以我们配置一个过滤器<filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class></filte...
2024-01-10
springboot缓存添加redis缓存支持
1.添加maven支持<!-- springboot cache --><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId></dependency><!-- redis --><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-start...
2024-01-10
springboot中使用redis由浅入深解析
正文很多时候,我们会在springboot中配置redis,但是就那么几个配置就配好了,没办法知道为什么,这里就详细的讲解一下这里假设已经成功创建了一个springboot项目。redis连接工厂类第一步,需要加上springboot的redis jar包<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis...
2024-01-10
springboot整合security和vue的实践
目录环境1.security参考资料认证流程原理:2.springboot整合security要点2.1获取登录用户信息2.2自定义登入登出url2.3自定义Handler返回json2.4记住我功能2.5验证码功能2.6限制登录次数2.7密码加密2.8后台提供接口,返回前端json,整合vue做前端登入登出3.测试环境springboot1.5.9完整代码,内有sql,先建库,在运行sql...
2024-01-10
springboot集成redis实现简单秒杀系统
本文实例为大家分享了springboot集成redis实现简单秒杀系统的具体代码,供大家参考,具体内容如下项目是有地址的,我会放到文章的最后面1. 直接service,我们会介绍两种秒杀模式public interface GoodsService { /** * 通过lua脚本实现的秒杀 * @param skuCode 商品编码 * @param buyNum 购买数量 * @return 购买数量...
2024-01-10
springboot整合freemarker详解
前提:开发工具:idea框架:spring boot、maven1、pom文件添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> <version>1.4.1.RELEASE</version> </dependency>2、新建spring web项目,会自动生成applicatio...
2024-01-10
springboot整合zookeeper和dubbo
序言dubbo就是个rpc框架,之前都是一直在用,现在稍微总结下以备以后使用。 我就直接贴代码了,代码肯定能运行,如果运行不了那么看我之前的zookeeper配置,或者把我贴的代码重新复制下,实在不行请留言,我看到会回复的。整体项目结构 项目是父子maven结构,父maven中基础jar包都依赖好了,子mave...
2024-01-10
springboot redis获取的key为什么是乱码?
redisTemplate.keys() 获取的值怎么是乱码redisconfigpublic RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) { RedisTemplate<Object, Object> template = new RedisTempla...
2024-02-27
如何使用springboot动态连接指定地址的redis?
我有一个需求是根据请求参数连接不同地址的redis所以我想写一个函数动态获取redisTemplate,传入指定的redis配置参数,以便连接不同的redis,这个函数类似这样:public static RedisTemplate<Object, Object> getRedisTemplate(RedisConnectInfo info) { // redisStandal...
2024-02-24
spring-data-redis的问题
spring的xml配置 <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig"> <property name="maxIdle" value="${redis.maxIdle}" /> <property name="maxTotal" value="${redis.maxTotal}" /> <property name="maxWaitMillis" value="${redi...
2024-01-10
spring-session(二)与spring-boot整合实战
本文内容纲要:spring-session(二)与spring-boot整合实战前两篇介绍了spring-session的原理,这篇在理论的基础上再实战。spring-boot整合spring-session的自动配置可谓是开箱即用,极其简洁和方便。这篇文章即介绍spring-boot整合spring-session,这里只介绍基于RedisSession的实战。原理篇是基于spring-session v1.2.2版本,...
2024-01-10
SpringBoot整合Redis及Redis工具类撰写实例
目录一、Maven依赖二、application.properties中加入redis相关配置三、写一个redis配置类四、写一个Redis工具类五、小结SpringBoot整合Redis的博客很多,但是很多都不是我想要的结果。因为我只需要整合完成后,可以操作Redis就可以了,并不需要配合缓存相关的注解使用(如@Cacheable)。看了很多博客后,我成功的...
2024-01-10
spring-boot redis:如何使用户的所有会话无效?
我是Redis的新手。我已经按照本教程将HttpSession与redis一起使用。https://docs.spring.io/spring-session/docs/current/reference/html5/guides/boot.html现在,我的应用程序具有“从所有设备注销”选项。单击后,如何删除或使该用户的所有会话无效?另外,当用户更改密码时,如何使除当前会话之外的所有会话无效?我...
2024-01-10
Spring@AutowiredforListTypes
Let’s see an example - we have three pets that we’d like to register them on the public animal registry.public abstract class Animal { ... }@Componentpublic class MyDog extends Animal { ... }@Componentpublic class MyCat extends Animal { ... }@Componentpubl...
2024-01-10
springboot之swagger快速启动(新的ui)
knife4j 是 springfox-swagger 的增强UI实现,为Java开发者在使用Swagger的时候,能拥有一份简洁、强大的接口文档体验。该UI增强包主要包括两大核心功能:文档说明 和 在线调试文档说明: 根据Swagger的规范说明,详细列出接口文档的说明,包括接口地址、类型、请求示例、请求参数、响应示例、响应参数、...
2024-01-10
springcloud整合oauth2.0、security的一个问题
++++++请仔细看上图,我在加了最右边的两个依赖以后,服务一直注册不了请问是怎么回事?回答注册中心的 security 需要关闭csrf,这个有关掉吗...
2024-01-10
springboot整合shiro登录失败次数限制功能的实现代码
这次讲讲如何限制用户登录尝试次数,防止坏人多次尝试,恶意暴力破解密码的情况出现,要限制用户登录尝试次数,必然要对用户名密码验证失败做记录,Shiro中用户名密码的验证交给了CredentialsMatcher 所以在CredentialsMatcher里面检查,记录登录次数是最简单的做法。当登录失败次数达到限制,修改数据...
2024-01-10
springBoot service层事务控制的操作
springBoot使用事物比较简单,在Application启动类s上添加@EnableTransactionManagement注解,然后在service层的方法上添加@Transactional注解@Transactional属性属性类型描述valueString可选的限定描述符,指定使用的事务管理器propagationenum: Propagation可选的事务传播行为设置isolationenum: Isolation可选的事务隔...
2024-01-10
springboot手写一个自己的starter源码
springboot的最强大的就是那些xxxAutoconfiguration,但是这些xxxAutoConfiguration又依赖那些starter,只有导入了这些场景启动器(starter),我们很多自动配置类才能有用,并且还会新增一些功能,这次就来一起写个简单的starter,来看看内部到底是什么原理!脑中大概有个印象:我们要用一个场景(比如web),直...
2024-01-10
解决Springboot整合shiro时静态资源被拦截的问题
目录结构如下在自己配置的ShiroConfig中已经放行了filterChainDefinitionMap.put("/static/**", "anon");login.ftl也引用了静态资源<link rel="stylesheet" type="text/css" href="/logins/css/normalize.css" rel="external nofollow" /><link rel="stylesheet" type="text/css" href="/logins/css/demo...
2024-01-10
Spring整合Weblogic jms实例详解
本文主要介绍weblogic jms的配置,包括JMS 服务器和JMS 模块(连接工厂、队列、远程 SAF 上下文、SAF 导入目的地、SAF 错误处理)的配置;并在Spring环境下进行消息的监听及发送;为了更多的使用webloigc jms的功能,发送的队列使用saf配置的远程weblogic jms队列(两边的weblogic版本须一致),当然本地也是可以...
2024-01-10
使用springboot的jar包能够以service方式启动
目录springboot jar包以service启动场景过程其他SpringBoot启动服务的三种方式1.IDEA启动2.命令行启动3.命令行编译为jar启动springboot jar包以service启动场景打出的jar包用java -jar肯定是可以启动的。 这种方式原生简单,但是对运维不友好。于是要求改造,希望可以用service命令来启动。过程技术上完全可以实现...
2024-01-10
spring-redis无法连接到远程主机
我有以下骆驼对Redis进行投票: from("timer://pollredis?fixedRate=true&period=5") // poll redis .setHeader("CamelRedis.Command", constant("LPOP")) .setHeader("CamelRedis.Key", constant("shipments"))...
2024-01-10
springboot 使用ThreadLocal的实例代码
目录springboot 使用ThreadLocalThreadLocal在springboot使用中的坑springboot 使用ThreadLocal本文参考慕课教程给出一个在spring boot中使用ThreadLocal实现线程封闭的实例。首先创建一个包含ThreadLocal成员变量的实例:public class RequestHolder { private final static ThreadLocal<Long> requestHolder = new ThreadLocal<...
2024-01-10
SpringSecurity整合Jwt过程图解
这篇文章主要介绍了SpringSecurity整合Jwt过程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下一、创建项目并导入依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><dependency><groupId>org.springf...
2024-01-10
