# Custom serializer configuration

**URL:** <https://forum.flowable.org/t/custom-serializer-configuration/3302>\
**Category:** Flowable Engine\
**Created:** [January 24, 2019, 8:22am UTC](https://forum.flowable.org/t/custom-serializer-configuration/3302 "2019-01-24T08:22:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apolci](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/apolci/32/1012_2.png) [@apolci](https://forum.flowable.org/u/apolci)\
**Post date:** [January 24, 2019, 8:22am UTC](https://forum.flowable.org/t/custom-serializer-configuration/3302/1 "2019-01-24T08:22:28Z")

</div>

Hi!

I have a process instance global variable containing a JPA entity. My application is a simple spring boot application using flowable-spring-boot-starter-rest.  
Everything works fine until I try to retrieve the variable value with rest api (http://…/process-api/runtime/tasks//variables//data) when I get a java.io.NotSerializableException. I understand the problem and I read the note about custom serializer in [https://www.flowable.org/docs/userguide/index.html#restVariables](https://www.flowable.org/docs/userguide/index.html#restVariables) but it’s not clear to me how to do it.

I’d like to serialize the entity as json, and I tried to add this bean in my configuration, but it seems to me that it’s ignored:

```
@Bean
public DmnRestResponseFactory dmnRestResponseFactory() {
    return new DmnRestResponseFactory() {
        @Override
        protected void initializeVariableConverters() {
            super.initializeVariableConverters();
            variableConverters.add(shipmentDataConverter());
        }
    };
}

```

Is there any example of how to register a custom serializer?

Thank you in advance for any help.

Andrea

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [February 14, 2019, 2:39pm UTC](https://forum.flowable.org/t/custom-serializer-configuration/3302/2 "2019-02-14T14:39:28Z")

</div>

Hey Andrea,

I would presume that you are using the Spring Boot auto-configuration from Flowable. It seems that currently you can’t override the `DmnRestReponseFactory` bean. The reason why your bean is not picked up is that the Rest Servlet is registered in a child context via the [`DmnEngineRestConfiguration`](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/dmn/DmnEngineRestConfiguration.java) in the [`RestApiAutoConfiguration.DmnEngineRestApiConfiguration`](https://github.com/flowable/flowable-engine/blob/c7b993bc2e0a199d6240350c7effa635180afec5/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/RestApiAutoConfiguration.java#L140).

If you want you can create a PR that would allow you to add custom converters to the `DmnRestResponseFactory`.

Cheers,  
Filip
