run程序后出现了这个问题
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commonService': Unsatisfied dependency expressed through field 'commonDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commonDao' defined in file [C:springboot-schematargetclassescomdaoCommonDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/spring/boot/starter/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
它很长,而且总是会出现nest,原来是嵌套问题,这个是我看这篇文章了解的
https://blog.csdn.net/qq_50541673/article/details/123617180?ops_request_misc=&request_id=&biz_id=102&utm_term=Error%20creating%20bean%20with%20name%20&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-1-123617180.142^v13^rank_v32,157^v14^new_3&spm=1018.2226.3001.4187
然后我就找到了最根本的错误(嵌套里的最后一个),它的意思是我数据库没连上
Caused by: com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
我看了一下我的application.yml,原来是我的密码没加‘’单引号,导致数据库连不上,无语了。



