几天后,SQL连接会因MySQLNonTransientConnectionException而关闭

时间:2018-07-20 09:17:00

标签: spring-boot jpa

org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed

we are using JPA and connection is happening during app startup as a bean 
we have defined following properties..
# JDBC properties
spring.datasource.tomcat.initial-size=10
spring.datasource.tomcat.maxActive=30
spring.datasource.tomcat.minIdle=4
spring.datasource.tomcat.testOnBorrow=true
spring.datasource.tomcat.poolPreparedStatements=true
spring.datasource.tomcat.testWhileIdle=true
spring.datasource.timeBetweenEvictionRunsMillis = 60000
spring.datasource.validationQuery = SELECT 1

我们正在尝试在初始化过程中设置以上道具,因为这些道具会自动设置 豆创作 返回DataSourceBuilder                 。创建()                 .url(URL)                 .username(用户名)                 .password(密码)                 .build();

0 个答案:

没有答案