Official version Download:
Maven Central Warehouse: Http://central.maven.org/maven2/com/alibaba/druid/
Alibaba open Source Download: Http://code.alibabatech.com/mvn/releases/com/alibaba/druid/
GitHub Address: Https://github.com/alibaba/druid/
Web. XML configuration:
<Filter> <Filter-name>Druidwebstatfilter</Filter-name> <Filter-class>Com.alibaba.druid.support.http.WebStatFilter</Filter-class> <Init-param> <Param-name>Exclusions</Param-name> <Param-value>/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</Param-value> </Init-param></Filter><servlet> <Servlet-name>Druidstatview</Servlet-name> <Servlet-class>Com.alibaba.druid.support.http.StatViewServlet</Servlet-class></servlet><servlet-mapping> <Servlet-name>Druidstatview</Servlet-name> <Url-pattern>/druid/*</Url-pattern></servlet-mapping>
spring.xml Configuration:
<BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> < Propertyname= "Driverclassname"value= "${driverclassname}" /> <!--Basic Property URL, user, password - < Propertyname= "url"value= "${dburl}"/> < Propertyname= "username"value= "${dbname}" /> < Propertyname= "Password"value= "${dbpassword}" /> <!--Configure initialization size, minimum, maximum - < Propertyname= "InitialSize"value= "${initialsize}" /> < Propertyname= "Minidle"value= "${minidle}" /> < Propertyname= "Maxactive"value= "${maxactive}" /> <!--Configure the time to get the connection wait timeout - < Propertyname= "Maxwait"value= "60000" /> <!--How often the configuration interval is detected to detect idle connections that need to be closed, in milliseconds - < Propertyname= "Timebetweenevictionrunsmillis"value= "60000" /> <!--configures the minimum lifetime of a connection in a pool, in milliseconds - < Propertyname= "Minevictableidletimemillis"value= "300000" /> < Propertyname= "Validationquery"value= "Select ' X '" /> < Propertyname= "Testwhileidle"value= "true" /> < Propertyname= "Testonborrow"value= "false" /> < Propertyname= "Testonreturn"value= "false" /> <!--Configuring filters for monitoring statistics interception - < Propertyname= "Filters"value= "Stat" /></Bean>
Spring Consolidated data Source Druid