当前位置:网站首页>配置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
边栏推荐
猜你喜欢
微信小程序提交审核历史版本记录从哪里查看
皕杰报表在传参乱码
std::move()
Module 9 - Designing an e-commerce seckill system
自媒体爆款标题怎么写?手把手教你写热门标题
OPNsense安装配置Zenarmor
蔚来-软件开发工程师一面记录
Nocalhost - Making development more efficient in the cloud-native era
If someone asks you about distributed transactions again, throw this to him
Analysis of the implementation principle of UUID from the perspective of source code
随机推荐
中小规模网站架构
LeetCode 24. 两两交换链表中的节点
mysql出现:ERROR 1524 (HY000): Plugin ‘123‘ is not loaded
使用哈工大LTP测试分词并且增加自定义字典
暑期总结4
Pulling drills - 56 Finding the right interval
微信小程序,全局变量一个地方改变了其他地方的状态也跟着改变。
Open Office XML 格式里如何描述多段具有不同字体设置的段落
flask-restplus接口地址404问题
再有人问你分布式事务,把这篇扔给他
A little self-deprecating deconstruction about farmers "code"
[Go WebSocket] 多房间的聊天室(一)思考篇
Nocalhost - 让云原生时代的开发更高效
基于UiAutomator2+PageObject模式开展APP自动化测试实战
Redis常用命令
实现内网穿透的最佳解决方案(无实名认证,完全免费)
Codeforces 862 C. Mahmoud and Ehab and the xor (技巧)
力扣练习——64 最长和谐子序列
LeetCode50天刷题计划(Day 16—— 两两交换链表中的节点(9.10-10.30)
From the product dimension, why can't we fully trust Layer2?