if change the ${druid.password} to my database password everything is well done
if druid not decode the password?
my db.properties
druid.Driver=com.mysql.cj.jdbc.Driver
druid.url=jdbc:mysql://localhost:3306/dongnanceshi?useSSL=false&useUncode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
druid.user=root
druid.password=fF4CHVVYbY4Q9iHXqaylbdMP9TrlroIq0Bh3cKldca9CX5J7QhKIoXTZ4Ar0JNkVx+GIqYhGvS4gHjA43yq2YQ==
druid.publickey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAI2z3FiKNWaIlynCGoe+SFOjG2Xd10QP6MNFCF3VcXG8PCLd/xRkkMx9ojfPMdXn8YhcbK79OcpPCkMnlhr2ux0CAwEAAQ==
spring-dao.xml
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="driverClassName" value="${druid.Driver}"/>
<property name="url" value="${druid.url}" />
<property name="username" value="${druid.user}"/>
<property name="password" value="${druid.password}"/>
<property name="filters" value="stat" />
<property name="connectionProperties" value="config.decrypt=true;config.decrypt.key=${druid.publickey}"/>
</bean>
Junit Test
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/spring-dao.xml","classpath:spring/spring-service.xml"})
public class TestID {
@Autowired
TEnvBusSiteAirHourdatainfectMapper tEnvBusSiteAirHourdatainfectMapper;
@Test
public void test3() {
List<TEnvBusSiteAirHourdatainfect> tEnvBusSiteAirHourdatainfects = tEnvBusSiteAirHourdatainfectMapper.queryAll("a34002");
}
}
AND the error log
[Druid-ConnectionPool-Create-1912172027] ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://localhost:3306/dongnanceshi?useSSL=false&useUncode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai, errorCode 1045, state 28000 java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
What as the issue? Note that you can see what Druid interprets as your properties by doing GET /status/properties