領先一步
VMware 提供培訓和認證,以加速您的進度。
瞭解更多此文章由 Vedran Pavić 編寫
我很高興代表社群宣布 Spring Session Corn-M2
和 Bean-SR6
的發布。這些版本將分別由 Spring Boot 2.2.0.M4
和 2.1.6.RELEASE
採用。
Corn-M2
Corn-M2
版本基於
Spring Session 核心模組 2.2.0.M2
Spring Session Data Geode 2.2.0.M2
Spring Session Data MongoDB 2.2.0.M3
Spring Session 2.2.0.M2
的一些重點是
基於 Redis 的簡單 SessionRepository
實作
重新設計的 @Configuration
類別現在與 proxyBeanMethods=false
相容
將專案的測試遷移到 JUnit 5
簡化專案結構
這些版本的完整詳細資訊可以在變更日誌中找到。
SimpleRedisOperationsSessionRepository
此版本最大的亮點是新的、簡單的、基於 Redis 的 SessionRepository
實作,它作為眾所周知的 RedisOperationsSessionRepository
的替代方案。
除了核心 SessionRepository
功能之外,原始的 RedisOperationsSessionRepository
還提供對 session 事件(轉換為 HttpSessionEvent
實例)的支援,並且還實作 FindByIndexNameSessionRepository
(允許檢索給定 principal 的 sessions)。 對於這兩個功能的支援是有代價的,因為在 sessions 需要保存在 Redis 中的方式上存在一些複雜性。
對於許多應用程式來說,對 session 事件和 principal 索引的支援並非必不可少,這是提供 SimpleRedisOperationsSessionRepository
替代方案的主要動機。 新的 SessionRepository
尚未在 Spring Session 的配置基礎結構中獲得一流的支援,因此可以如下配置
@EnableSpringHttpSession
public class RedisSessionConfiguration {
@Autowired
private RedisConnectionFactory redisConnectionFactory;
@Bean
public RedisOperations<String, Object> sessionRedisOperations() {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(this.redisConnectionFactory);
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
return redisTemplate;
}
@Bean
public SimpleRedisOperationsSessionRepository sessionRepository(
RedisOperations<String, Object> sessionRedisOperations) {
return new SimpleRedisOperationsSessionRepository(sessionRedisOperations);
}
}
考慮試用 Corn-M2
版本和 SimpleRedisOperationsSessionRepository
,並告訴我們您的反饋!
Bean-SR6
Bean-SR6
版本基於
Spring Session 核心模組 2.1.7.RELEASE
Spring Session Data Geode 2.1.4.RELEASE
Spring Session Data MongoDB 2.1.4.RELEASE
Spring Session 2.1.7.RELEASE
是一個維護版本,它帶來了一些錯誤修復以及通常的相依性升級。 這些版本的完整詳細資訊可以在變更日誌中找到。
專案頁面 | 文件 | 問題 | Gitter | Stack Overflow