The access_token needs to be stored in Redis when connecting to a framework pushed by a small program. The framework provides storage logic, and you only need to pass the RedissonClient object into it. Redisson RBucket failed to store data in FST because a method in FST was missing.

The FST that Redisson relies on is 2.57, and this version is ok. The main reason is that the dependency version of the current project is reduced, because dubbo relies on the lower version, which affects the original version.

The solution is very simple, force the application to use the version, today is not about how to solve this, is to say some other inconvenient points.

The default encoding

According to the official document, the default encoding is Jackson. According to our above error, the error was reported only when FST encoding was used. The encoding mode was not set separately in the project, so is the document not updated in time?

In the constructor Config object we see the default encoding:

The configuration code

If you want to use a different encoding method, you should be able to specify the encoding method directly by configuring the redisson-spring-boot-starter.

If you look at the source code and see that there is no such configuration information, you can customize a YML file to configure the relevant information, and then specify the path of the YML file.

spring:
  redis:
    redisson:
      config: classpath:redisson.yml
Copy the code

The logic for automatic assembly in the Starter package is as follows: load the entire file according to the configuration path and convert it into a Config object.

So if I want to replace the default encoding method, I need to customize a redisson.yml file for configuration, which is inconvenient to be honest, the most convenient is to configure directly, such as

spring.redis.redisson.codec=org.redisson.codec.JsonJacksonCodec
Copy the code

Another point is that if you need custom files for configuration, you don’t differentiate multiple environments very well. You need a configuration file for each environment, and then specify which custom file to use in the configuration center.

Spring. Redis. Redisson. Config: the classpath: redisson - beta. Yml or spring. Redis. Redisson. Config: classpath:redisson-product.ymlCopy the code

Then redisson.yml the contents of this file cannot be placed in the configuration center, it cannot be loaded. If you need to change the code that loads the configuration to put it in, you can’t read it through the classpath, you need to read it from the configuration center.

If you really feel bad to use a rewrite bar, also very fast, ha ha!

About the author: Yin Jihuan, a simple technology lover, the author of Spring Cloud Micro-service – Full stack Technology and Case Analysis, Spring Cloud Micro-service Introduction combat and Progress, the founder of the public account Monkey World.

I have organized a very complete learning material. If you are interested, you can search “Monkey World” on wechat and reply to the keyword “learning material” to obtain the Spring Cloud, Spring Cloud Alibaba, Sharing-JDBC sub-library sub-table and task scheduling framework XXL-job that I have organized. MongoDB, crawler and other related information.