Autowire異常主要由三個情況發生的 1. 你的ServiceImpl必須以@Service或@Component注解才行。 2. 自動寫入的時候把接口寫成實現類了,例如 @Autowired private BrandServiceImpl brandServiceImpl; 應該是 @Autowired private BrandService brandService; 3. 在Dao 類上加上@Repository注解
轉載于:https://www.cnblogs.com/liweizai/p/6757943.html