Caused by: java.lang.ClassCastException: class io.jooby.internal.ServiceRegistryImpl$$Lambda$458/0x0000000800dbf350 cannot be cast to class com.fasterxml.jackson.databind.json.JsonMapper (io.jooby.internal.ServiceRegistryImpl$$Lambda$458/0x0000000800dbf350 and com.fasterxml.jackson.databind.json.JsonMapper are in unnamed module of loader 'app')
@jknack AvajeInjectModule seems doesn't work as expected, at least for me. With a very basic example (reproduced in test https://github.com/jooby-project/jooby/commit/c9c81fdc85470df43b086abb257d611a6fd0574a) Jooby inner services injection fails with class cast exception, for example
JsonMapper
:I assume this is due to the fact that services already wrapped into lambda in
singletone()
https://github.com/jooby-project/jooby/blob/03bb5875786f9414c9339902cf015e264d06e173/jooby/src/main/java/io/jooby/internal/ServiceRegistryImpl.java#L61Hence, the default binding need to be changed to
beanScope.provideDefault(key.getType(), e.getValue()::get);
Also,
Config
binding was removed as it is already in service registry