小编Lau*_*nzo的帖子

Spring Session Redis 数据未清除 Redis 中会话的索引

我正在使用 Spring Session Redis Data(使用自动配置进行配置,到目前为止没有自定义),它默认用作FindByIndexNameSessionRepository实现SessionRepository

但是,有时在 Redis 中(在会话已过期但未执行注销之后),前缀为 的密钥的spring:session:index:org.springframework.session.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME:TTL 仍为 -1,这意味着 Redis 不会使该密钥过期。

为什么 Spring Session(Redis 数据)在会话过期时不清理这个键?我在文档中也找不到提及。

我已按照文档中所述将带有主体名称的属性存储到会话中,但这并不能解决此问题。有关详细信息,请参阅https://docs.spring.io/spring-session/reference/api.html#api-findbyindexnamesessionrepository

使用的Redis版本:6.2.6(bitnami/redis的docker镜像:6.2.6)

相关依赖:

  • 春季启动2.6.2
  • 春季安全5.6.1
  • 春季会议核心 2.5.0
  • Spring会话数据Redis 2.5.0
  • Spring数据Redis 2.6.0

我不希望索引持久化的原因是,如果有很多用户至少登录过一次并且有一个密钥持久化到Redis(其作用类似于索引),那么Redis将不得不存储可能无法访问的数据很长一段时间(或根本没有)。

spring-security spring-data-redis spring-boot spring-session

6
推荐指数
1
解决办法
3346
查看次数

使用Spring Boot 1.3,在Netbeans中更改时,spring-boot-devtools和Thymeleaf模板不会进行实时重新加载

Spring Boot 1.3引入了spring-boot-devtools来提供与Spring Reloaded类似的功能,以重新加载修改后的类并更新Thymeleaf模板,而无需重新运行您的应用程序.

之前我一直在使用Spring Boot 1.2.7(使用Spring Reloaded),我可以动态修改模板而无需重新启动Spring Boot应用程序.

当我修改和保存Java代码/ Thymeleaf模板时,相同的应用程序现在既不重新加载Thymeleaf模板也不重新加载/重新启动应用程序.

我正在使用嵌入在Netbeans IDE中的Netbeans 8.0.2和Maven(3.0.5版).该应用程序打包为JAR.

在Netbeans中,在项目属性 - >构建 - >编译下,勾选了一个"编译保存"复选框.我通过修改.java文件并检查/ target/classes中的时间戳来验证这实际上是有效的.

以下是Netbeans中项目"运行操作"属性:

我的pom.xml中有以下依赖项(包括其他因不相关而被排除在外):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
</dependency> 
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

有了这个,我应该开始了,因为Spring Boot Blog提到了以下内容:

"如果包含spring-boot-devtools模块,任何类路径文件更改都将自动触发应用程序重启."

并在Spring Boot官方文档中做了类似的评论.

编辑:我尝试使用带有版本标签1.2.7.RELEASE的spring-boot-maven-plugin,并在保存模板时在浏览器中显示我的Thymeleaf模板的突然变化.看来至少Thymeleaf模板的问题不是因为spring-boot-devtools,而是因为spring-bot-maven-plugin.

问题可分为两部分:

1)如果使用较新版本的spring-boot-maven-plugin,则不会因某种原因重新加载的Thymeleaf模板(1.3.0.RELEASE)2)即使.class文件中也不会发生应用程序重载/重启触发器/ target/classes在修改和保存相应的.java文件时得到更新.

更新:已验证未加载devtools(主线程名称未重新启动).解决2)通过将Netbeans项目属性中的运行项目操作中的执行目标更改为以下内容:

process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Run Code Online (Sandbox Code Playgroud)

旧的执行目标是package spring-boot:run.谷歌搜索显示其他人在使用spring-boot:run运行项目时遇到spring-boot-devtools问题.

现在唯一的问题是Thymeleaf模板在保存时不会实时更新.

thymeleaf spring-boot netbeans-8

3
推荐指数
1
解决办法
1929
查看次数

基于默认组在 AWS Elasticache 中创建自定义参数组

我正在尝试在 AWS Elasticache 中创建自定义参数组。

我想使用默认参数组作为基础(名为 default.redis5.0.cluster.on 的组,因为这里有我需要的其他所有内容,但只有一个我想更改的属性),请参阅https:// docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/ParameterGroups.Redis.html有关默认参数组的更多详细信息

我的基本假设是,我需要将默认参数组值复制到 Terraform 资源,然后只修改我需要更改的唯一参数。然而,这会产生大量参数,而且似乎不是最简单的方法。

如果我需要在default.redis5.0.cluster.on参数组中复制参数,那么我需要将这些参数放在 Terraform 中。有没有办法将默认资源组导入为 Terraform 配置?

amazon-web-services amazon-elasticache terraform terraform-provider-aws

1
推荐指数
1
解决办法
2663
查看次数