開啟監控統計功能
druid的監控統計功能是通過filter-chain擴充套件實現,如果你要開啟監控統計功能,配置statfilter,具體如下所示
"databasepasswordcallback"
class
="com.haiyoung.util.databasepasswordcallback"
/>
"datasource_pyxis"
class
="com.alibaba.druid.pool.druiddatasource"
destroy-method
="close"
init-method
="init"
lazy-init
="true"
>
name
="url"
value
="$"
/>
name
="username"
value
="$"
/>
name
="password"
value
="$"
/>
name
="connectionproperties"
value
="......"
/>
name
="passwordcallback"
ref="databasepasswordcallback"
/>
name
="initialsize"
value
="$"
/>
name
="minidle"
value
="$"
/>
name
="maxactive"
value
="$"
/>
name
="maxwait"
value
="$"
/>
name
="maxpoolpreparedstatementperconnectionsize"
value
="$"
/>
name
="timebetweenevictionrunsmillis"
value
="$"
/>
name
="minevictableidletimemillis"
value
="$"
/>
name
="testwhileidle"
value
="true"
/>
name
="testonborrow"
value
="false"
/>
name
="testonreturn"
value
="false"
/>
name
="validationquery"
value
="$"
/>
name
="removeabandoned"
value
="$"
/>
name
="removeabandonedtimeout"
value
="$"
/>
name
="logabandoned"
value
="true"
/>
name
="proxyfilters"
>
>
bean
="druid_stat_filter"
/>
bean
="druid_wall_filter"
/>
bean
="druid_log_filter"
/>
list
>
property
>
bean
>
class
="com.alibaba.druid.filter.stat.statfilter"
id="druid_stat_filter"
>
name
="slowsqlmillis"
value
="10000"
/>
name
="logslowsql"
value
="true"
/>
name
="mergesql"
value
="true"
/>
bean
>
class
="com.alibaba.druid.wall.wallfilter"
id="druid_wall_filter"
>
name
="logviolation"
value
="true"
/>
bean
>
class
="com.alibaba.druid.filter.logging.slf4jlogfilter"
id="druid_log_filter"
>
name
="statementexecutablesqllogenable"
value
="true"
/>
name
="statementcreateafterlogenabled"
value
="false"
/>
name
="statementprepareafterlogenabled"
value
="false"
/>
name
="statementparametersetlogenabled"
value
="false"
/>
name
="statementcloseafterlogenabled"
value
="false"
/>
name
="resultsetcloseafterlogenabled"
value
="false"
/>
bean
>
配置statviewservlet
druid內建提供了乙個statviewservlet用於展示druid的統計資訊。
這個statviewservlet的用途包括:
根據配置中的url-pattern來訪問內建監控頁面,如果是上面的配置,內建監控頁面的首頁是/druid/index.html
監控頁面展示
druid監控功能很豐富,可以通過配置開啟,官網wiki有詳細介紹
Druid連線池配置
druid連線池,在阿里 使用過很好用的。druid集連線池,監控於一體整好復合當前專案的需要,專案是ssm結構,首先spring配置datasource,配置如下 id datasource class com.alibaba.druid.pool.druiddatasource init met...
druid連線池的配置
從其他連線池切換為druid的連線池很簡單,首先新增依賴 然後修改mybatis的連線池為druiddatasource的連線池 配置資料來源oracle 資料庫 datasource class com.alibaba.druid.pool.druiddatasource init method ...
druid連線池的配置
從其他連線池切換為druid的連線池很簡單,首先新增依賴 然後修改mybatis的連線池為druiddatasource的連線池 配置資料來源oracle 資料庫 datasource class com.alibaba.druid.pool.druiddatasource init method ...