Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation don't mention aditional dependencies for each type of serializer [DATAREDIS-433] #1008

spring-projects-issues opened this issue Sep 21, 2015 · 3 comments
status: declined type: documentation type: enhancement


Copy link

@spring-projects-issues spring-projects-issues commented Sep 21, 2015

Diego Magalhaes opened DATAREDIS-433 and commented

Hey guys,

Using the spring-boot-starter-redis in my pom.xml and trying to use this Configuration class leads me to a compile error in the 1.3.0.M5:

public class RedisConfig {
    private JedisConnectionFactory jedisConnFactory;

    public StringRedisSerializer stringRedisSerializer() {
        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
        return stringRedisSerializer;

    public JacksonJsonRedisSerializer<ShortenedURL> jacksonJsonRedisJsonSerializer() {
        return new JacksonJsonRedisSerializer<>(ShortenedURL.class);

    public RedisTemplate<String, ShortenedURL> redisTemplate() {
        RedisTemplate<String, ShortenedURL> redisTemplate = new RedisTemplate<>();
        return redisTemplate;

The error is

Information:Using javac 1.8.0_05 to compile java sources
Information:java: Errors occurred while compiling module 'api'
Information:Module "api" was fully rebuilt due to project configuration/dependencies changes
Information:18/09/2015 17:05 - Compilation completed with 1 error and 0 warnings in 5s 216ms
Error:(26, 16) java: cannot access org.codehaus.jackson.type.JavaType
class file for org.codehaus.jackson.type.JavaType not found

The JacksonJsonRedisSerializer<ShortenedURL> only works after adding the jackson-mapper-asl dependency to my pom.xml

As @wilkinsona noted in spring-projects/spring-boot#3985, it's like that by design, but IMO the documentation fails to provide that explicitly. (

From the framework perspective, the data stored in Redis is just bytes. While Redis itself supports various types, for the most part these refer to the way the data is stored rather then what it represents. It is up to the user to decide whether the information gets translated into Strings or any other objects. The conversion between the user (custom) types and raw data (and vice-versa) is handled in Spring Data Redis through the RedisSerializer interface (package which as the name implies, takes care of the serialization process. Multiple implementations are available out of the box, two of which have been already mentioned before in this documentation: the StringRedisSerializer and the JdkSerializationRedisSerializer. However one can use OxmSerializer for Object/XML mapping through Spring 3 OXM support or either JacksonJsonRedisSerializer, Jackson2JsonRedisSerializer or `GenericJackson2JsonRedisSerializer for storing data in JSON format. Do note that the storage format is not limited only to values - it can be used for keys, values or hashes without any restrictions.

Could we be more specific in the sense if the user wants to use another serializer such as Jackson in this case, that he nees to add proper configuration to his pom.xml/gradle etc?

There's another formatting issue in this section of the docs near the GenericJackson2JsonRedisSerializer word, not making that code formatted. Should I open a separated issue for that?

Affects: 1.6 GA (Gosling)

Reference URL:

Referenced from: pull request #172, and commits ee97681, 3524775

Copy link

@spring-projects-issues spring-projects-issues commented Oct 5, 2015

Oliver Drotbohm commented

Hm, isn't it rather obvious that you need Jackson on the classpath, if you want to use a Jackson-specific serializer? I mean if we scattered the reference documentation with the very basic instructions on how to pull in a library via Maven & Gradle at every place a feature is described that needs some third party dependency, we'd probably double the amount of docs and – most importantly – would probably blur the documentation and remove focus on the important parts

Copy link

@spring-projects-issues spring-projects-issues commented Oct 16, 2015

Diego Magalhaes commented

@oliver couldn't we just state that if the user wants to use another serializer different from the bundled ones, that he nees to add proper configuration do his dependency management?

My difficulties there were reading the docs and not knowing in the specific scenario of the serializers that I should do something with the maven or not. A simple sentence would do the magic

Copy link

@spring-projects-issues spring-projects-issues commented Apr 6, 2020

Mark Paluch commented

PR never got merged so closing this ticket

@spring-projects-issues spring-projects-issues added status: declined type: documentation type: enhancement labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
status: declined type: documentation type: enhancement
None yet

No branches or pull requests

2 participants