springboot项目报错

使用springboot,springboot报错

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [C:\ideaProjects\demo\target\classes\com\example\demo\dao\UserDao.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

想知道怎么解决,让项目启动起来

你调用dao层的UserDao这个类但是没被注入Spring容器,看后面的报错可能是你mybatis出了问题,检查一下自己的mybatis依赖pom文件和UserDao对应的mybatis的xml配置文件。排查不出来可以把依赖和xml还有UserDao文件发我看看。

dao注入问题,有啥可以问我

没有配置好datasource,检查数据库相关的配置

简单来说就是数据库那些对象和参数初始化失败

不能注入对象,sql不能使用,看看数据库