我使用的Idea,步骤和代码跟老师的一样,结果项目就是启动不起来,下面的是定位到的错误信息:
2021-10-08 00:49:28.686 ERROR 4612 --- [ main] o.s.boot.SpringApplication : Application run failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\first\target\classes\com\mp\dao\UserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
看了前面的相关回答说是application.yml配置问题
这是application.yml配置
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/mp?useSSL=false&serverTimezone=GMT%2B8
username: root
password: xxxx