jooby icon indicating copy to clipboard operation
jooby copied to clipboard

jooby-avaje-inject wrong or confusing behavior

Open ogrammer opened this issue 1 month ago • 1 comments

I am using jooby-avaje-inject, and I noticed AvajeInjectModule returns true in lateinit. This causes me to not be able to use jooby's require() to get my mvc controller classes.

I am trying to install the mvc controllers in the code of the Jooby subclass after installing the avaje inject module, but this exception happens: https://github.com/jooby-project/jooby/blob/27315c4f10f5792a40f32dc6f5e400084618d779/jooby/src/main/java/io/jooby/Jooby.java#L747

I believe the exception message is incorrect or at least confusing because on the condition !registry.isSet() it throws "service not found: class name". I think it should be "registry is not set" instead.

When I make a subclass of AvajeInjectModule and override lateinit to return false, the code works without issue.

Is the problem in the module or am I using require() incorrectly in a wrong place?

ogrammer avatar Nov 18 '25 19:11 ogrammer

can you share a code example? Controllers usually do a lazy require using a supplier

jknack avatar Nov 25 '25 21:11 jknack