druid访问监控首页index.html页面404 whitelabel error page This application has no explicit mapping for /error

问题:

配置druid 访问地址 http://localhost:8887/druid/index.html

报错:This application has no explicit mapping for /error, so you are seeing this as a fallback

druid版本:

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.21</version>
        </dependency>

将druid版本降低为 1.1.10 启动项目访问http://localhost:8887/druid/index.html 可以正常访问

 再次将druid版本升级为  1.1.13 访问报错 404

问题分析

druid版本1.1.10以上版本配置改变。

查询资料发现,1.1.10版本以上需要配置开启 stat-view-servlet ,不配置情况下为默认不开启 监控页面,其他一些配置 如sql监控也是默认不开启的,若是要开启某个功能要手动开启,配置参考

https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter

总结

若是要默认开启druid的配置,选择1.1.10及以下的版本,若是要选择手动开启某些配置,可以选择1.1.10以上的版本。


版权声明:本文为chenping1993原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。