spring 数据库重新连接
写了一个spring+hibernate的应用
数据库连接依靠web容器启动
代码
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
但是现在问题是数据库在局域网的其他机器上 由于网络不稳定总是断网 这样就会出现数据库连接错误
我想写一个listener 去监听数据库的连接
怎么能在监听到错误后让web容器从新加载哪??或者是有没有其他的办法?