Druid Data Source Configuration
<BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> < Propertyname= "url"value= "${ds1.url}" /> < Propertyname= "username"value= "${ds1.username}" /> < Propertyname= "Password"value= "${ds1.password}" /> <!--Configure monitoring Statistics interception filters, remove post-monitoring interface SQL cannot be counted - < Propertyname= "Filters"value= "Stat" /> <!--Configure initialization size, minimum, maximum - < Propertyname= "Maxactive"value= " the" /> < Propertyname= "InitialSize"value= "1" /> < Propertyname= "Minidle"value= "1" /> <!--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= " the" /> <!--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" /> <!--open Pscache, and specify the size of Pscache on each connection - < Propertyname= "Poolpreparedstatements"value= "true" /> < Propertyname= "Maxpoolpreparedstatementperconnectionsize"value= " the" /> </Bean>
This data source is already in use at this time
To view .../proname/druid/add servlet in Web. xml
<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>
Now you have access to Druid management, where you can configure filtering, like this:
<servlet> <Servlet-name>Druidstatview</Servlet-name> <Servlet-class>Com.alibaba.druid.support.http.StatViewServlet</Servlet-class> <Init-param> <Param-name>Allow</Param-name> <Param-value></Param-value> </Init-param> <Init-param> <Param-name>Deny</Param-name> <Param-value>192.168.146.1</Param-value> </Init-param> <Init-param> <Param-name>Principalsessionname</Param-name> <Param-value>Session.user</Param-value> </Init-param> <Init-param> <Param-name>Principalcookiename</Param-name> <Param-value>Cookies.user</Param-value> </Init-param></servlet>
But now there are some tags in the druid, no data: Add under Web. xml:
<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>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</Param-value> </Init-param></Filter><filter-mapping> <Filter-name>Druidwebstatfilter</Filter-name> <Url-pattern>/*</Url-pattern></filter-mapping>
This will monitor all requests;
The first blog post is a start
Welcome to correct me, I small white, mouth under mercy,/embrace/embrace/embrace
Druid Use and Configuration