IntelliJ IDEA shows errors when using Spring's @Autowired annotation

前端 未结 26 2461
栀梦
栀梦 2020-12-07 15:40

IntelliJ IDEA is showing errors when I use Spring\'s @Autowired annotation in the class, but the class is functioning without any problem.

Here is this

26条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 16:05

    a little late but i hope it helps to someone else.

    Make sure to put the @Service on the implementation class for the service

    @Service
    public class ServiceNameImpl implements ServiceName {
    
        @Override
        public void method(ObjectType paramName) {
            //CODE
        }
    
    }
    

    That's how i fixed the error.

提交回复
热议问题