版本:
Spring Boot:2.3.12.RELEASE
redisson 3.7.3
场景:
集成 redisson 项目启动时候,报非法反射问题,虽然不影响使用,但看起来很烦人:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.redisson.misc.URIBuilder (file:/D:/DevTools/maven/Repository/org/redisson/redisson/3.7.0/redisson-3.7.0.jar) to field java.lang.reflect.Field.modifiers
WARNING: Please consider reporting this to the maintainers of org.redisson.misc.URIBuilder
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
解决:
1、把 redisson 的版本换成 3.6.3 即可
<!-- 原生 redisson -->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.6.3</version>
</dependency>
2、如果是 redisson-spring-boot-starter 3.9.x以上版本,切换版本为 3.8.2 即可
<!-- redisson 集成 spring boot starter,需要注意版本兼容 -->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.8.2</version>
</dependency>