Vavr/Javaslang with Lagom

Hi, i am trying to integrate Vavr with Lagom.

The only problem i am facing, is serializing the types provided by the library using lagom ObjectMapper.

I have been trying to register the Vavr jackson module _ with Lagom, by applying the steps described in this pages:

If i add this line to application.conf:
lagom.serialization.json.jackson-modules += io.vavr.jackson.datatype.VavrModule

Only part of the types are successfully serialized. Lagom fails in serializing the types:

  • io.vavr.collection.List
  • …?

And the types that are successfully serialized have weird json structures.

The type io.vavr.control.Option is serialized it this structure:

Option<String> name = Option.of("wht?");

   "name": {
       "empty": false,
       "async": false,
       "singleValued": true,
       "lazy": false,
       "defined": true,
       "orNull": "wht?"

When it should serialize in the same way as scala.Option

Option<String> name = Option.of("ok")

{ "name": "ok" }

Option<String> name = Option.none


I have also tryed to register the Vavr jackson module directly on the ObjectMapper.
The results were the same.

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import io.vavr.jackson.datatype.VavrModule;

public class CustomJacksonModule extends SimpleModule {

    public void setupModule(SetupContext setupContext) {
        ObjectMapper mapper = setupContext.getOwner();
        mapper.registerModule(new VavrModule());


import com.lightbend.lagom.javadsl.server.ServiceGuiceSupport;
import util.CustomJacksonModule;

public class AppModule extends AbstractModule implements ServiceGuiceSupport {
    protected void configure() {
        bindService(BlueService.class, BlueServiceImpl.class);


// ??? play.modules.disabled += play.core.ObjectMapperModule
// ??? lagom.serialization.json.jackson-modules += io.vavr.jackson.datatype.VavrModule
lagom.serialization.json.jackson-modules +=

akka {
  # Enable supply serializer provided in Akka 2.5.8+ to avoid supply use of Java serialization.
  actor.serialization-bindings {
    "akka.Done" = akka-misc
    "" = akka-misc
    "akka.remote.UniqueAddress" = akka-misc
    "java.util.UUID" = lagom-json
    "io.vavr.control.Option" = lagom-json
    "io.vavr.collection.List" = lagom-json
  allow-java-serialization = off

We have run out of ideas. Its very difficult for us to adopt the java Apis coming from Scala background. Due to client policies we cant resort to using Scala.
As anyone ever successfully done this, what are we missing ?

p.s. only 2 links for new users ?!

We maneged to solve the problem.
We were trying to access lagom ObjectMapper by using guice

@Inject public MyClass(final ObjectMapper objectMapper)

It seems that the ObjectMapper injected didn’t have fully registered all the jackson modules required.
Everything worked as expected after creating a new ObjectMapper.
It seems that Vavr 0.9.2 is fully compatible with Lagom 1.4.7.