Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
Spring Boot 集成 Druid 后,访问监控界面却报404,怎么办?_创想鸟

Spring Boot 集成 Druid 后,访问监控界面却报404,怎么办?

Spring Boot 集成 Druid 后,访问监控界面却报404,怎么办?

springboot项目,druid配置了后台监控,如下图,访问的时候还是报404?

在spring boot项目中配置druid监控后,访问后台监控界面却报404可能是由于以下原因:

servlet未注册:
确保在druidconfig类中正确注册了servletregistrationbean。

//配置一个管理后台的servlet@beanpublic servletregistrationbean statviewservlet(){    servletregistrationbean bean = new servletregistrationbean(new statviewservlet(),"/druid/*");    map initparams = new hashmap();    initparams.put("loginusername","sunyard");    initparams.put("loginpassword","sunyard");    initparams.put("allow","");//value为空字符串的话,默认允许所有地址访问    bean.setinitparameters(initparams);    return bean;}

filter未注册:
同样确保在druidconfig类中正确注册了filterregistrationbean。

//配置一个web监控的filter@Beanpublic FilterRegistrationBean webStatFilter(){    FilterRegistrationBean bean = new FilterRegistrationBean();    bean.setFilter(new WebStatFilter());    Map initParams = new HashMap();    initParams.put("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");    bean.setInitParameters(initParams);    bean.setUrlPatterns(Arrays.asList("/*"));    return  bean;}

防火墙未开放:
druid默认阻止所有ip访问监控界面,在druidconfig类的statviewservlet方法中,配置allow参数。例如:initparams.put(“allow”,”127.0.0.1″)。端口冲突:
确保应用程序未在与druid监控界面冲突的端口上运行。启动类问题:
请确保您的启动类上注明@springbootapplication注解。

如果按照上述检查后仍提示404,请尝试以下操作:

清除应用缓存(例如,清除intellij idea的编译缓存)。重新启动应用。

以上就是Spring Boot 集成 Druid 后,访问监控界面却报404,怎么办?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/54214.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
Kafka配置出错怎么办Linux系统
上一篇 2025年11月9日 14:21:48
linux怎么查看过去登陆的用户信息
下一篇 2025年11月9日 14:21:51

相关推荐

发表回复

登录后才能评论
关注微信