报错:org.springframework.beans.factory.UnsatisfiedDependencyException

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘booksController’: Unsatisfied dependency expressed through field ‘booksService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.huang.ssmbuild.service.BooksService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

这个问题是因为BooksService中的实现类并没有注入到bean中。
错误之前:
报错:org.springframework.beans.factory.UnsatisfiedDependencyException
报错:org.springframework.beans.factory.UnsatisfiedDependencyException
而@Service注解是需要加在BooksServiceImpl中的,而BooksService仅仅只是一个接口。这样就能把BooksService所对应的BooksServiceImpl具体实现类或方法注入到bean中。

报错:org.springframework.beans.factory.UnsatisfiedDependencyException