SystemApplication启动报错

来源:3-1 集成持久层框架Mybatis

Leisure80

2021-04-06

http://img.mukewang.com/szimg/606bb78c0987ad7905340332.jpg

http://img.mukewang.com/szimg/606bb78c0937b8a906760242.jpg

http://img.mukewang.com/szimg/606bb78c09748c1e12780478.jpg

20.614 ERROR o.s.boot.SpringApplication    :826  Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testMapper' defined in file [C:\Project\course\system\target\classes\com\course\system\mapper\TestMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:337)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)

at com.course.system.SystemApplication.main(SystemApplication.java:27)


第3张图SpringBootApplication如果不加括号里的,在前面连接数据库就不行

写回答

1回答

甲蛙

2021-04-06

按课程来肯定是没问题的,数据库连接不上,应该检查链接、用户名、密码、端口、库名是否都正确。

可以像课程一样,在IDEA里配下数据库连接。

先解决这个问题再往下

0
0

Spring Cloud+ Vue前后端分离开发企业级在线视频系统

全网稀缺课程 市场热门项目+主流框架 一课掌握前后端技术

1743 学习 · 1697 问题

查看课程