java – No beans match CDI injection point

Question:

I'm looking to implement CDI. But when I use the @Inject annotation I get notified with this warning

"No beans match the injection point"

Line of code I get notified

@Inject private LancamentoDadosDao lancamentoDadosDao;

DAO class

    @Component
    @RequestScoped
    public class LancamentoDadosDao {

        private Session session;
        private Result result;

        public LancamentoDadosDao(Session session, Result result) {
            this.session = session;
            this.result = result;
        }
}

What could be happening for this warning to appear?

Answer:

To be used with CDI your class must have a parameterless constructor or your parameterized constructor must be annotated with @Inject (but then make sure the parameters are injected correctly).

Scroll to Top
AllEscort