Skip to content

Annotation processor fails when ServerRequest / ServerResponse are field-injected in controller #661

@ah3nan

Description

@ah3nan

When injecting Helidon io.helidon.webserver.ServerRequest or io.helidon.webserver.ServerResponse as fields inside a controller, the annotation processor fails compilation with an error like:

java: No dependency provided for com.example.app.ProductController on com.example.app.ProductController$Route, java: Dependencies [com.example.app.ProductController] are not provided - there are no @Singleton, @Component, @Factory/@Bean that currently provide this type. If this is an external dependency, consider specifying it via @External.

Steps to reproduce

@Controller
@Path("/products")
public class ProductController {

    @Inject
    ServerRequest request;

    @Inject
    ServerResponse response;

    @Produces("text/plain")
    @Get
    String getSimple() {

        return "simple";
    }
} 
Image

Here is the code generated by the annotation processor.

Image Image Image Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions