'Quarkus Amazon Lambda + dependency injection error

I'm creating an AWS Lambda using the latest version of Quarkus Java framework. The Quarkus documentation says that lambdas can use injection annotations from CDI or Spring.

However, I always get a NullPointerException when I try to invoke a method on any injected resource, this is my lambda witten in Quarkus:

public class GreetingLambda implements RequestHandler<Person, List<User>> {

    @Inject
    @RestClient
    JasonPlaceholderClient jasonPlaceholderClient;

    @Inject
    GreetingService greetingService;

    @Override
    public List<User> handleRequest(Person input, Context context) {
        greetingService.sayHello(); //throws NPE
        jasonPlaceholderClient.getUsers(); //throws NPE
        return List.of(new User ("", "", "", ""));
    }
}

If I remove the call to the dependencies, the code runs just fine.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source