IDEA中引入mybaties在application.yml文件中配置数据库信息无法连接
springboot中从yml文件中读取数据库信息读不到
·
在使用springboot集成mybaties遇到application.yml文件中数据库信息无法读取,导致连接不上报错Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ‘***’@‘localhost’ (using password: YES)
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user '***'@'localhost' (using password: YES)
### The error may exist in com/example/springboot_mybatis/mapper/StudentMapper.xml
### The error may involve com.example.springboot_mybatis.mapper.StudentMapper.findAll
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user '***'@'localhost' (using password: YES)
原因是application.properties的优先级比yml文件高,先读取里面的数据,导致yml中配置不生效。
更多推荐
已为社区贡献1条内容
所有评论(0)