Could not autowire field in spring. why?

后端 未结 8 1790
长情又很酷
长情又很酷 2020-12-08 20:09

I keep getting this error, and can\'t figure out why.. yes I know there many people had similar issues, but reading the answers they got, does not solve my problem.

8条回答
  •  眼角桃花
    2020-12-08 21:06

    I was getting this same error and searching for it led me here. My fix appeared to be simply to add @Component annotation to the implementation of the abstract service.

    In this case, that would look like:

    import org.springframework.stereotype.Component;
    
    ...
    
    @Component
    public class ContactServiceImpl implements ContactService {
    

提交回复
热议问题