Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wjsqjg
EasyAdmin
提交
00bbe754
E
EasyAdmin
项目概览
wjsqjg
/
EasyAdmin
与 Fork 源项目一致
Fork自
lakernote / EasyAdmin
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
EasyAdmin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
00bbe754
编写于
9月 18, 2021
作者:
lakernote
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(bugfix)[整体](Druid错误discard long time none received connection)
上级
31c8be71
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
12 deletion
+20
-12
src/main/java/com/laker/admin/config/DruidConfig.java
src/main/java/com/laker/admin/config/DruidConfig.java
+18
-10
src/main/resources/application.yaml
src/main/resources/application.yaml
+2
-2
未找到文件。
src/main/java/com/laker/admin/config/DruidConfig.java
浏览文件 @
00bbe754
...
...
@@ -18,11 +18,13 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.*
;
import
java.io.IOException
;
/**
* durid 监控页面配置 默认地址 localhost:8080/druid/login.html
*
* @author laker
*/
@Configuration
...
...
@@ -30,6 +32,14 @@ import java.io.IOException;
public
class
DruidConfig
{
private
static
final
String
DEFAULT_ALLOW_IP
=
"127.0.0.1"
;
/**
* 解决druid 日志报错:discard long time none received connection:xxx
*/
@PostConstruct
public
void
setUsePingMethod
()
{
System
.
setProperty
(
"druid.mysql.usePingMethod"
,
"false"
);
}
/**
* 参见:DruidStatViewServletConfiguration
* 黑白名单
...
...
@@ -135,13 +145,13 @@ public class DruidConfig {
/**
* 去除底部广告
*
* @param properties
* @return
*/
@Bean
@ConditionalOnProperty
(
name
=
"spring.datasource.druid.statViewServlet.enabled"
,
havingValue
=
"true"
,
matchIfMissing
=
true
)
public
FilterRegistrationBean
removeDruidFilterRegistrationBean
(
DruidStatProperties
properties
)
{
public
FilterRegistrationBean
removeDruidFilterRegistrationBean
(
DruidStatProperties
properties
)
{
// 获取web监控页面的参数
DruidStatProperties
.
StatViewServlet
config
=
properties
.
getStatViewServlet
();
// 提取common.js的配置路径
...
...
@@ -149,16 +159,14 @@ public class DruidConfig {
String
commonJsPattern
=
pattern
.
replaceAll
(
"\\*"
,
"js/common.js"
);
final
String
filePath
=
"support/http/resources/js/common.js"
;
// 创建filter进行过滤
Filter
filter
=
new
Filter
()
{
Filter
filter
=
new
Filter
()
{
@Override
public
void
init
(
javax
.
servlet
.
FilterConfig
filterConfig
)
throws
ServletException
{
public
void
init
(
javax
.
servlet
.
FilterConfig
filterConfig
)
throws
ServletException
{
}
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
throws
IOException
,
ServletException
{
chain
.
doFilter
(
request
,
response
);
// 重置缓冲区,响应头不会被重置
response
.
resetBuffer
();
...
...
@@ -169,9 +177,9 @@ public class DruidConfig {
text
=
text
.
replaceAll
(
"powered.*?shrek.wang</a>"
,
""
);
response
.
getWriter
().
write
(
text
);
}
@Override
public
void
destroy
()
{
public
void
destroy
()
{
}
};
FilterRegistrationBean
registrationBean
=
new
FilterRegistrationBean
();
...
...
src/main/resources/application.yaml
浏览文件 @
00bbe754
...
...
@@ -12,8 +12,8 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
1
min-idle
:
20
max-active
:
30
0
min-idle
:
5
max-active
:
2
0
test-on-borrow
:
true
validation-query
:
select
1
profiles
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录