SpringBoot 整合Mybatis 的时候报错


APPLICATION FAILED TO START


Description:

Parameter 0 of method sqlSessionFactoryBean in com.anole.db.config.MybatisConfigurer required a bean of type 'javax.sql.DataSource' that could not be found.

The following candidates were found but could not be injected:
- Bean method 'dataSource' in 'JndiDataSourceAutoConfiguration' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' in 'XADataSourceAutoConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager'

Action:

Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.

Process finished with exit code 1

无法找到数据源,检查下数据库连接池(就是存放数据库账号密码的地方),是否存在是否正确引用

'javax.sql.DataSource' that could not be found.
可能原因 用户密码错误 网络防火墙拦截

看看jar包引入没有,版本是否冲突,连接池配置是否正确。账号密码正确的情况下,数据库地址后配置的参数有可能问题。