这个错误,整整搞了5天,5天。
最后查到问题:依赖包错误。我以为是代码的错误呢。
还报了如下错误:(这里只截取部分的重要错误)
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/dom4j/io/STAXEventReader
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productCategoryRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.ord.dataobject.ProductCategory com.ord.repository.ProductCategoryRepository.findOne(java.lang.Integer)! No property findOne found for type ProductCategory!
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'categoryServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productCategoryRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.ord.dataobject.ProductCategory com.ord.repository.ProductCategoryRepository.findOne(java.lang.Integer)! No property findOne found for type ProductCategory!
这个问题我搞了5天,最后终于发现的问题。
依赖包错误。
依赖包错误很严重,我这个是在test测试的时候就报错了,要是在实际开发过程当中就很严重了。
因为我这个是在测试的时候就报错了,而这个错误就是依赖包导入错误。
所以,这个问题就是依赖包错误。你只要仔细回想回想自己的依赖包导入了哪个,应该导入哪个,哪个没导入,都要好好仔细的找找。
这个错误没有固定的解决办法。
如果在依赖包找不到错误的话,实在找不到了也可以加我QQ3506346737