就是这个controller类无法自动装配service类
你的BookService或者BookServiceImpl上增加@Service注解没得
把SpringMvcConfig类上@ComponentScan 里面的值改成com.itheima
,SpringConfig类上的@ComponentScan 去掉。
看一下是不是maven上的依赖搞错了
自动注入的问题,看下:
1、看下service或者service中是否有引入其他dao层,若是dao层引入不到那报错也会汇聚到controller中
2、看下spring扫描的路径是否包含congtroller或者service