My tomcat cannot start if DB is down. How i want spring allow to start even the DB is down, and will reconnect the DB once DB its alive?
Im using Spring 4 and BoneCP for the datasource. Below is my jdbc configuration in applicationContext.xml. Im using Tomcat 8.5.
<bean id="defaultDataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close" p:driverClass="${jdbc.driverClassName}"
p:jdbcUrl="${jdbc.url}" p:username="${jdbc.user}" p:password="${jdbc.pass}"
p:maxConnectionsPerPartition="${partition.max.connections}"
p:minConnectionsPerPartition="${partition.min.connections}"
p:partitionCount="${partition.count}" p:acquireIncrement="${partition.acquire.incrementcount}"
p:statementsCacheSize="${statements.cache.size}"
p:idleMaxAgeInMinutes="${idle.max.age.minutes}" />
<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource" ref="defaultDataSource" />
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>