#SpringBoot:使用Druid的Web管理界面 #Druid Monitor @FDDLC |
您所在的位置:网站首页 › localhost8080怎么打开 › #SpringBoot:使用Druid的Web管理界面 #Druid Monitor @FDDLC |
一、先上效果:
访问地址为:localhost:8080/druid 可根据自己的项目上下文和端口号自行调整访问地址。 二、过程概述 1、先建一个SpringBoot的Web项目 2、pom依赖有(可自行微调):spring-boot-starter-parent(父依赖)、spring-boot-starter-web、mysql-connector-java、spring-jdbc、druid-spring-boot-starter 3、运行SpringBoot应用,然后在浏览器中访问 三、实现过程 1、项目结构:
2、依赖: 4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.5 cn.fddlc P114_SpringBoot_Druid 0.0.1-SNAPSHOT P114_SpringBoot_Druid Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter-web mysql mysql-connector-java 8.0.21 org.springframework spring-jdbc com.alibaba druid-spring-boot-starter 1.1.10
3、application.properties: spring.datasource.username=root spring.datasource.password=root spring.datasource.url=jdbc:mysql:///starblog?characterEncoding=UTF8&serverTimezone=Asia/Shanghai spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #Druid的Web管理界面默认是没有用户名和密码的,可直接访问:localhost:8080/druid #如果项目名为SSM,端口为8081,则访问地址为:localhost:8081/druid #下面是设置用户名和密码的方式: spring.datasource.druid.stat-view-servlet.login-username=admin spring.datasource.druid.stat-view-servlet.login-password=admin
4、主程序: package cn.fddlc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class P114SpringBootDruidApplication { public static void main(String[] args) { SpringApplication.run(P114SpringBootDruidApplication.class, args); } }
5、运行主程序,然后在浏览中访问: localhost:8080/druid
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |