question:
1. When JDBC connects to the database, it gets stuck in the following position
hikari.HikariDataSource |- HikariPool-1 - Starting...
2. After a while, the JDBC connection times out, and the following error is reported
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
3. However, you can connect to the database manually, and you can also connect to the database when debugging JAVA code locally. This problem will occur after deploying with k8s
Solution
(1) Add the following content after the URL of the JDBC connection
&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10
(2) Then add the following configuration in the pom.xml file
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
(3) After redeployment, solve