HTTP-500+Request processing failed; nested exception is java.lang.NullPointerException

详细错误情况如下:

 注意红圈部分,基本上是seriveImpl或者controller出现这种空指针的情况,原因是少写了注释@Autowired

但是加上之后出现新的问题

 提示could not atuowire. No bean of XXX type found 

运行之后报错

No qualifying bean of type 'com.wym.oa.custom.service.CustomerService' 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.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1658)

综合两个错误,首先分析定位是配置文件未扫描到base-package导致的,我找了半天愣是没发现问题

后来想去我们@Service的注释是在ServiceImpl里面声明的,会不会base-package也要填写Impl的路径,修改完之后,这个错误算是没了

原文地址:https://www.cnblogs.com/lbrs/p/12859695.html