Junit單元測試錯誤信息:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com.li.service.BookService' available: expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=BookServiceImp)}
使用Qualifier注解報紅:
經過排查發現,BookServiceImp 類 忘記寫了 實現BookService接口了,接口中方法是手動敲的,沒有自動生成。