No bean named ‘bookMapper’ available&Error creating bean with name ‘BookService

396 阅读1分钟

报错信息

Cannot resolve reference to bean 'bookMapper' while setting bean property 'bookMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'bookMapper' available

解决 web.xml是否设置为总配置位置

<init-param>
            <param-name>contextConfigLocation</param-name>
            <!--加载的是总的配置文件-->
            <param-value>classpath:applicationContext.xml</param-value>
        </init-param>