Skip to content

jooby-apt: MVC generated controllers require jakarta-inject should be documented because of code generation. #3460

@agentgt

Description

@agentgt

Because we now generate the code for MVC controllers one has to make sure to add the jakarta inject dependency as scope compile/provided.

Alternatively we could make the io.jooby:jooby pom depend on it so it automatically gets pulled in but that may not go over well with folks that use the fluent api instead.

So at the minimum I'm thinking we just add it to the documentation that they need to add:

<dependency>
    <groupId>jakarta.inject</groupId>
    <artifactId>jakarta.inject-api</artifactId>
    <version>2.0.1</version>
</dependency>

Happy to do the changes on this or the previous bugs I filed recently to help out.


Also for the code generation maybe consider doing:

@SuppressWarnings("exports") // add this annotation
public OpsController_(jakarta.inject.Provider<OpsController> provider)

The above annotation will then make modular builds not show a warning if one does only:

requires jakarta.inject;

Otherwise they will have to do:

requires transitive jakarta.inject;

Because the constructor is public.

However it maybe required to use the transitive regardless if reflective access is used (this I'm unsure on and need to test).

If is required than we need to document it as well that one needs to add requires transitive.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions