org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.mzf.service.I

alonwang

关注

阅读 41

2022-04-13

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.mzf.service.Impl.BooksServiceImpl] for bean with name 'booksServiceImpl' defined in class path resource [spring-service.xml]; nested exception is java.lang.ClassNotFoundException: com.mzf.service.Impl.BooksServiceImpl
org.springframework.beans.factory.CannotLoadBeanClassException:无法找到[com.mzf.service.Impl.BooksServiceImpl]对于在类路径 resource [ spring - service . xml ]中定义了名称为“ books Service I mpl ”的 be an ,嵌套异常为java.lang.ClassNotFoundException:com.mzf.service.Impl.BooksServiceImpl

解决办法:

1.注释掉BooksServiceImpl的声明

<!--<bean id="booksServiceImpl" class="com.mzf.service.Impl.BooksServiceImpl">
    <property name="booksDao" ref="booksDao"></property>
</bean>-->

 

2.在BooksServiceImpl类上加入注解@Service

 

 

精彩评论(0)

0 0 举报