原因时你的properties资源文件中命名和spring关键字冲突
username=root password=root url=jdbc:mysql://localhost:3306/spring driver=com.mysql.cj.jdbc.Driver
换成下面的方法即可解决
jdbc.username=root jdbc.password=root jdbc.url=jdbc:mysql://localhost:3306/spring jdbc.driver=com.mysql.cj.jdbc.Driver
- JdbcTemplate SQLException connection errorCode localhostjdbctemplate sqlexception connection errorcode quot sqlexception connection errorcode sqlexception connection localhost错误 sqlexception errorcode access denied 39 sqlexception localhost password sqlexception connection exception interrupt hikaridatasource sqlexception connection hikaripool mysql localhost 39 connect connection the localhost actions connection the localhost refused