小编Chr*_*ory的帖子

从 Eclipse 切换到 IntelliJ 后,Spring Boot 属性扩展不起作用

我们的应用程序具有我们从 Maven 项目文件中动态获取的属性。

info:
  build:
    artifact: @project.artifactId@
    name: @project.name@
    description: @project.description@
    version: @project.version@
Run Code Online (Sandbox Code Playgroud)

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-application-info-automatic-expansion-maven

当我们使用 Eclipse 时,这些都不是问题,但现在转移到 InelliJ 时,除非我为这些动态属性提供一些硬编码值,否则应用程序将无法启动。

我收到此错误:

19:47:20.962 [main] INFO  com.edlogics.ElrcApplication - Spring Boot configuration: profiles = [local, chris]
19:47:20.968 [main] INFO  com.edlogics.ElrcApplication - Spring Boot configuration: properties = {}
Exception in thread "main" while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
 in 'reader', line 74, column 11:
        name: @project.name@
              ^

 org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:420)
 org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
 org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:586)
 org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) …
Run Code Online (Sandbox Code Playgroud)

intellij-idea spring-boot

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

如何在 Spring Data Redis 2.0.X 中使用 Lettuce 异步连接与 Spring Cache Abstraction (RedisCacheManager)

我们最近将应用程序升级到 Spring Boot 2 (2.0.3.RELEASE)。随着 Spring Data Redis 的升级,也升级到了 2.0.8.RELEASE。我们从使用 Jedis 切换到 Lettuce,因为启动升级文档说现在这是默认设置。

我将生菜连接池定义为:

spring:
  redis:
    ssl: true
    lettuce:
      pool:
        max-active: 250
        max-idle: 250
        min-idle: 50
        max-wait: 2000ms
      shutdown-timeout: 100ms
Run Code Online (Sandbox Code Playgroud)

今天我注意到在一台开发服务器上,我们在执行 Redis 读/写时遇到了很多线程阻塞。路径如下所示:

io.lettuce.core.internal.AbstractInvocationHandler:invoke:80
|
|__io.lettuce.core.FutureSyncInvocationHandler:handleInvocation:62
   |
   |__io.lettuce.core.LettuceFutures:awaitOrCancel:112 
      |
      |__io.lettuce.core.protocol.AsyncCommand:await:81
         |
         |__java.util.concurrent.locks.LockSupport:parkNanos:215
Run Code Online (Sandbox Code Playgroud)

有时我们看到线程等待 2 秒,有时我们看到它等待 19 秒。

我开始研究 Spring Redis 的不同选项,例如管道。

https://github.com/lettuce-io/lettuce-core/wiki/Asynchronous-API

我遇到的问题是我找不到使 LettuceConnection 异步的方法。我看到在管道传输时调用 LettuceConnection.getAsyncConnection() 。据我所知,管道仅在使用 RedisTemplate 时可用。从 Spring Data Redis 2 开始,RedisCacheManager 不再使用 RedisTemplate;它使用 RedisCacheConfiguration。

所以,我的问题是我们如何使用 Spring 缓存抽象 (RedisCacheManager) 进行异步 Redis?

redis spring-data lettuce spring-boot

5
推荐指数
0
解决办法
2470
查看次数

标签 统计

spring-boot ×2

intellij-idea ×1

lettuce ×1

redis ×1

spring-data ×1