Most of the time I use @Inject annotation in MicroProfile based microservices I get "No bean is eligible for injection to the injection point[JSR-365 5.2.2]" as a warning. What is the reason for this warning and what can be done in order to overcome it? Say for example. I wrote a code for property file injection-
@Path("/configProperty")
@Singleton
public class ConfigPropertyResource{
@Inject
@ConfigProperty(name = "username")
private String username;
@GET
@Path("/mp-config")
@Produces(MediaType.APPLICATION_JSON)
public Response mpConfig() {
Map<String, Object> configProperties = new HashMap<>();
return Response.ok(configProperties).build();
}
}
Now at @Inject annotation, it shows a warning sign with the suggestion-No bean is eligible for injection to the injection point[JSR-365 5.2.2].
I am using Microprofile version 3.3 with wildfly 19.1 as run time.
Note: By adding @SuppressWarnings("cdi-ambiguous-dependency"), it's gone, but it didn't make sense.