Servlet.init() for servlet springMVC threw exception

添加service层服务后, 通过controller调用service层报如下错误

Servlet.init() for servlet springMVC threw exception


检查代码serviceimpl中 有添加注解配置的啊

Servlet.init() for servlet springMVC threw exception


然后查看spring-mvc.xml文件中的 注解配置 配置如下,

Servlet.init() for servlet springMVC threw exception

目录结构如下:

Servlet.init() for servlet springMVC threw exception


发现配置的注解 只控制了controller层,而service层是不会扫描注解的,所以需要修改注解配置为

Servlet.init() for servlet springMVC threw exception

这样整个com.test包都能被注解扫描到


注解参考: http://blog.****.net/chunqiuwei/article/details/16115135