spring Access denied for user ‘xx‘@‘localhost‘ (using password: YES)
Spring通过配置文件读取数据库连接时,报下面这个错。
spring Access denied for user 'xx'@'localhost' (using password: YES)
错误原因:
在系统中也有个username属性,这时系统变量覆盖了Properties中的值,使得获取username的值为系统的用户名xx,密码为properties中的password去查询数据库,此时用户名名和密码并不匹配就会报错。在Spring完成注入时是用 “${…}” 方式获取值完成注入的。而通过
原创
2020-12-26 20:53:02 ·
466 阅读 ·
1 评论