这是indexloc提供的服务,不要输入任何密码
Skip to content

Register a custom EnumSerializer to overwrite the default EnumSerializer #227

@gembin

Description

@gembin

Create a custom CustomEnumSerializer, and add it to a SimpleModule as following:

public class CustomEnumSerializer extends StdScalarSerializer{
//... custom code here
}

public class MySimpleModule extends SimpleModule{
public void setupModule(SetupContext context) {
addSerializer(Enum.class,new CustomEnumSerializer());
}
}
and finally objectMapper.registerModule(new MySimpleModule());

But, currently, the CustomEnumSerializer dose not overwrite the default one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions