I realized that I haven’t set the time out for the JDBCTemplate using the setQueryTimeOut method. My code is in production as I would ideally want a solution to set the timeout from some configuration instead of recompiling the code. Is there a way to set the query time out via say the data source configuration or any other property outside the Java.
I tried via the accepted solution to this post. Didn’t work for me. I get org.springframework.beans.NotWritablePropertyException: Invalid property 'connectionProperties' of bean class
You can use the
queryTimeoutfield with configuration:<property name="queryTimeout" value="${query.timeout}/>PropertyPlaceholderConfigurerto load properties from a.propertiesfile on the classpath. The easiest way is through<context:property-placeholder location=".." />query.timeout=xin your.propertiesfiles