当前位置:网站首页>配置druid数据源「建议收藏」
配置druid数据源「建议收藏」
2022-08-10 11:11:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
引用jar包:
dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
destroy-method="close">
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT" />
<property name="username" value="root" />
<property name="password" value="123456" />
<property name="filters" value="stat" />
<property name="maxActive" value="20" />
<property name="initialSize" value="1" />
<property name="maxWait" value="60000" />
<property name="minIdle" value="1" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="poolPreparedStatements" value="true" />
<property name="maxOpenPreparedStatements" value="20" />
</bean>
显示druid监控页面
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
<init-param>
<param-name>loginUsername</param-name>
<param-value>druid</param-value>
</init-param>
<init-param>
<param-name>loginPassword</param-name>
<param-value>druid</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/105614.html原文链接:https://javaforall.cn
边栏推荐
- Hangdian Multi-School-Loop-(uncertainty greedy + line segment tree)
- 不止跑路,拯救误操作rm -rf /*的小伙儿
- 力扣练习——64 最长和谐子序列
- 即时零售业态下如何实现自动做账?
- 快速上手,征服三种不同分布式架构调用方案
- Does your child lack self-discipline?Ape Counseling: Pay attention to "blank" in the schedule to give children more control
- 【Untitled】
- Weilai-software development engineer side record
- LeetCode 92. 反转链表 II
- Some tips for using Unsafe
猜你喜欢
随机推荐
【小程序 | 启航篇】一文打通任督二脉
Kyligence 通过 SOC 2 Type II 审计,以可信赖的企业级产品服务全球客户
今天面了个腾讯拿38K出来的大佬,让我见识到了基础的天花板
电脑怎么设置屏幕息屏时间(日常使用分享)
LeetCode 21. 合并两个有序链表
Licking Exercise - 58 Verifying Binary Search Trees
LeetCode 61. 旋转链表
LeetCode 19. 删除链表的倒数第 N 个结点
【机器学习】浅谈正规方程法&梯度下降
即时零售业态下如何实现自动做账?
Intel pushes 20220809 CPU microcode update to patch Intel-SA-00657 security vulnerability
AUTOCAD - reducing spline curve control points, the advanced CAD practice (3)
力扣练习——56 寻找右区间
LeetCode_628_三个数的最大乘积
Where can I view the version record of WeChat applet submission review history?
flask-restplus接口地址404问题
StoneDB 文档捉虫活动第一季
LeetCode_152_乘积最大子数组
英特尔推送20220809 CPU微码更新 修补Intel-SA-00657安全漏洞
How to join We Media, learn about these 5 monetization modes, and make your account quickly monetize