问题:按照正常的程序将session 共享引入工程,但是一直取不到

原因:springboot 的版本不同导致,存session的springboot 用的是springboot1.5.6,而取session的springboot版本是2.1.5。

解决方式1:统一springboot的版本(特别推荐)

解决方式2:改变部分jar的版本(权宜之计-兼容)

compile('org.springframework.session:spring-session-data-redis')
compile('org.springframework.security.oauth:spring-security-oauth2:2.0.14.RELEASE')
{
exclude module: 'org.slf4j:slf4j-api' exclude module: 'org.springframework.security:spring-security-core'
exclude module: 'org.springframework.security:spring-security-config'
exclude module: 'org.springframework.security:spring-security-crypto'
exclude module: 'org.springframework.security:spring-security-web'
}
compile('org.springframework.security:spring-security-core:4.2.19.RELEASE')
compile('org.springframework.security:spring-security-config:4.2.19.RELEASE')
compile('org.springframework.security:spring-security-crypto:4.2.19.RELEASE')
compile('org.springframework.security:spring-security-web:4.2.19.RELEASE')

 共享session的配置类 

@Configuration
@EnableRedisHttpSession
public class HttpSessionConfig { @Bean
public DefaultCookieSerializer defaultCookieSerializer(){
DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer();
cookieSerializer.setUseBase64Encoding(false);
return cookieSerializer;
} }

 请求

head:

Cookie:SESSION=145485qwedwa778djwahijheqw

spring.session.store-type = redis
security.headers.cache = false
security.sessions = NEVER
security.user.name =
security.user.password =
package com.XXXXXXX.marketcontrol.manager.config;

import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration
@Order(SecurityProperties.BASIC_AUTH_ORDER)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.httpBasic()
.and()
.authorizeRequests()
.antMatchers("/", "/app/**", "/pub/**", "/api/**","/opera/**").permitAll()
.antMatchers("/**").permitAll()
.anyRequest().authenticated()
.and()
.csrf().disable()
.headers().defaultsDisabled().cacheControl();
}
}

session共享问题、springboot 版本不统一问题的更多相关文章

  1. 【快学springboot】11.整合redis实现session共享

    前言 这里都是基于前面的项目基础上的.springboot整合redis非常的方便,这也是springboot的宗旨,简化配置.这篇文章就教大家如何使用springboot整合redis来实现sess ...

  2. springboot+redis实现session共享

    1.场景描述 因项目访问压力有点大,需要做负载均衡,但是登录使用的是公司统一提供的单点登录系统,需要做session共享,否则假如在A机器登录成功,在B机器上操作就会存在用户未登录情况. 2. 解决方 ...

  3. 从.Net到Java学习第八篇——SpringBoot实现session共享和国际化

    从.Net到Java学习系列目录 SpringBoot Session共享 修改pom.xml添加依赖 <!--spring session--> <dependency> & ...

  4. 二十三、springboot之session共享

    通过redis实现session共享 SpringBoot集成springsession 1.引入依赖(gradle方式) dependencies { compile('org.springfram ...

  5. springboot+spring session+redis+nginx实现session共享和负载均衡

    环境 centos7. jdk1.8.nginx.redis.springboot 1.5.8.RELEASE session共享 添加spring session和redis依赖 <depen ...

  6. 基于SpringBoot+Redis的Session共享与单点登录

    title: 基于SpringBoot+Redis的Session共享与单点登录 date: 2019-07-23 02:55:52 categories: 架构 author: mrzhou tag ...

  7. SpringBoot 整合Shiro实现动态权限加载更新+Session共享+单点登录

    作者:Sans_ juejin.im/post/5d087d605188256de9779e64 一.说明 Shiro是一个安全框架,项目中主要用它做认证,授权,加密,以及用户的会话管理,虽然Shir ...

  8. springboot(十八)-session共享

    前言 在传统的单服务架构中,一般来说,只有一个服务器,那么不存在 Session 共享问题,但是在分布式/集群项目中,Session 共享则是一个必须面对的问题,先看一个简单的架构图: 在这样的架构中 ...

  9. SpringBoot一个依赖搞定session共享

    原文:微信公众号:Java开发宝典  https://mp.weixin.qq.com/s/_VFY9lXqNhH8Nh4HC9tuMg 1. 前言 在传统的单服务架构中,一般来说,只有一个服务器,那 ...

  10. springboot集成springsession利用redis来实现session共享

    转:https://www.cnblogs.com/mengmeng89012/p/5519698.html 这次带来的是spring boot + redis 实现session共享的教程. 在sp ...

随机推荐

  1. 073_SFDC Limit

    我们在开发的过程中,应多注意一些系统自身的限制,以及遇到此类问题的应对措施: Description Synchronous Limit Asynchronous Limit Total number ...

  2. 面试题 --MySQL索引

    InnoDB引擎与MyISAM引擎的区别 ? InnoDB支持事务,MyISAM不支持事务 InnoDB支持行级锁,表级锁,MyISAM只支持表级锁 InnoDB支持外键,MyISAM不支支持外键 I ...

  3. 如何添加Eclipse项目到SVN资源库

    Eclipse项目添加到SVN版资源库有如下好处:一是轻松备份,每天做的修改内容一键提交:二方便合作,比较大的项目,多个人一起工作的时候,每人及时将完成的代码提交,别人可以下载浏览:三展示项目完成进度 ...

  4. pritunl zero 零信任系统

    pritunl zero 零信任系统 一.概述 1.介绍 Pritunl Zero是一个零信任系统,它可以在不使用VPN的情况下从不受信任的网络安全地访问内部服务. 2.背景 内网搭建了类百度文库系统 ...

  5. 关于windows更新时间,设置更新时间段

    https://jingyan.baidu.com/article/bad08e1eda412f09c85121c6.html https://www.dadighost.com/help/39372 ...

  6. 掌控安全学院SQL注入靶场延时注入

    第一关 第二关

  7. Mint UI中的坑:datetime-picker在PC浏览器上可以显示弹出的日期选择,但是在手机上是空白

    在网上搜了一下,发现,在根组件App.vue上写入这个就可以了

  8. 山寨e网通公告

    SHANZGONGG山寨e网通V1.0[换行]软件完全免费,官方绝不会索取任何费用,请勿被骗,后果自负.[换行]如果你有什么更好的建议或者需要哪里改进的地方,请联系作者QQ206044600反馈,前提 ...

  9. 对mvc模式的理解

    Model-View-Controller MVC模式是个威力强大的复合模式,是由数个设计模式结合起来的模式: 我们先看一下一个mp3播放器的设计,来由浅至深地了解这个设计模式的精髓所在: 从最直观的 ...

  10. 【NPDP专项练习】第五章 工具与绩效度量

    第五章 工具与绩效度量 1.这是一种使用一系列的迭代轮数通过专家组对未来可能的一种预测 A 决策一制作方法论 B 德尔菲 C 实施路线 D 组合标准 答案:B 解析 德尔菲流程(DelphiProce ...