【springMVC】dataSource注入username属性失败,导致getConnection超时或报错的解决办法
这是我的Druid数据连接池的properties文件:
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/users?serverTimezone=UTC&useSSL=FALSE&allowPublicKeyRetrieval=TRUE
username=root
password=123456
在applicationContext.xml里使用EL表达式注入属性
结果:获取conncetion超时
解决办法:
更换用户名username的键名
properties里:OtherName=root
然后更改注入时的EL表达式为${OtherName},其他不动