您的位置:首页 > 产品设计 > UI/UE

druid 应用到项目中

2016-05-11 12:50 471 查看
主要是为了扩展JDBC的一些限制,可以让程序员实现一些特殊的需求,比如向密钥服务请求凭证、统计SQL信息、SQL性能收集、SQL注入检查、SQL翻译等,程序员可以通过定制来实现自己需要的功能

1.配置applicationContext.xml文件

<bean
name="dataSource"
class="com.alibaba.druid.pool.DruidDataSource"
init-method="init"
destroy-method="close">

<property
name="url"
value="${jdbc_url}"
/>

<property
name="username"
value="${jdbc_username}"
/>

<property
name="password"
value="${jdbc_password}"
/>

<property
name="initialSize"
value="0"
/>

<property
name="maxActive"
value="20"
/>

<property
name="maxIdle"
value="20"
/>

<property
name="minIdle"
value="0"
/>

<property
name="maxWait"
value="60000"
/>

</bean>
使用阿里巴巴温少提供的druid
2.配置web.xml

添加如下配置:

<!-- druid监控 -->

    <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>

启动项目访问项目路径+druid/index.html
http://192.168.1.130:8080/bms-tops/druid/index.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Druid