企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
1、添加依赖 ~~~ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>hj-frame</artifactId> <groupId>com.hj.cloud</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <version>1.0-SNAPSHOT</version> <artifactId>hmall-bootAdmin</artifactId> <description>管理和监控SpringBoot应用程序</description> <dependencies> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> </dependencies> <build> <finalName>hmall-bootAdmin</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.hjf.MonitorApplication</mainClass> </configuration> </plugin> </plugins> </build> </project> ~~~ 2、application.yml 配置 ~~~ server: port: 9004 spring: application: name: hmall-bootAdmin security: user: name: admin password: 123456 logging: config: classpath:logback-spring.xml ~~~ 3、监控启动类 ~~~ /** * 功能说明:监控服务启动类 * 创建人: lihaijun * 创建时间:2019-10-18 */ @SpringBootApplication @EnableAdminServer public class MonitorApplication { public static void main(String[] args) { SpringApplication.run(MonitorApplication.class, args); System.out.println("监控中心启动成功..........." ); } } ~~~ 3、测试访问 浏览器访问([http://localhost:9004 (opens new window)](http://localhost:9100))可以看到以下界面。 ![](https://img.kancloud.cn/f5/29/f52952efac716fc596567509e30e9160_1361x943.png) ![](https://img.kancloud.cn/4d/cf/4dcfcdfdecfb1e149dc9fe4ebe76eb9a_2096x1155.png)