You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # spring-boot-demo-admin-client
  2. > 本 demo 主要演示了普通项目如何集成 Spring Boot Admin,并把自己的运行状态交给 Spring Boot Admin 进行展现。
  3. ## pom.xml
  4. ```xml
  5. <?xml version="1.0" encoding="UTF-8"?>
  6. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  7. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  8. <modelVersion>4.0.0</modelVersion>
  9. <artifactId>spring-boot-demo-admin-client</artifactId>
  10. <version>1.0.0-SNAPSHOT</version>
  11. <packaging>jar</packaging>
  12. <name>spring-boot-demo-admin-client</name>
  13. <description>Demo project for Spring Boot</description>
  14. <parent>
  15. <groupId>com.xkcoding</groupId>
  16. <artifactId>spring-boot-demo-admin</artifactId>
  17. <version>1.0.0-SNAPSHOT</version>
  18. </parent>
  19. <properties>
  20. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  21. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  22. <java.version>1.8</java.version>
  23. </properties>
  24. <dependencies>
  25. <dependency>
  26. <groupId>org.springframework.boot</groupId>
  27. <artifactId>spring-boot-starter-web</artifactId>
  28. </dependency>
  29. <dependency>
  30. <groupId>de.codecentric</groupId>
  31. <artifactId>spring-boot-admin-starter-client</artifactId>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.springframework.boot</groupId>
  35. <artifactId>spring-boot-starter-security</artifactId>
  36. </dependency>
  37. <dependency>
  38. <groupId>org.springframework.boot</groupId>
  39. <artifactId>spring-boot-starter-test</artifactId>
  40. <scope>test</scope>
  41. </dependency>
  42. </dependencies>
  43. <build>
  44. <finalName>spring-boot-demo-admin-client</finalName>
  45. <plugins>
  46. <plugin>
  47. <groupId>org.springframework.boot</groupId>
  48. <artifactId>spring-boot-maven-plugin</artifactId>
  49. </plugin>
  50. </plugins>
  51. </build>
  52. </project>
  53. ```
  54. ## application.yml
  55. ```yaml
  56. server:
  57. port: 8080
  58. servlet:
  59. context-path: /demo
  60. spring:
  61. application:
  62. # Spring Boot Admin展示的客户端项目名,不设置,会使用自动生成的随机id
  63. name: spring-boot-demo-admin-client
  64. boot:
  65. admin:
  66. client:
  67. # Spring Boot Admin 服务端地址
  68. url: "http://localhost:8000/"
  69. instance:
  70. metadata:
  71. # 客户端端点信息的安全认证信息
  72. user.name: ${spring.security.user.name}
  73. user.password: ${spring.security.user.password}
  74. security:
  75. user:
  76. name: xkcoding
  77. password: 123456
  78. management:
  79. endpoint:
  80. health:
  81. # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况
  82. show-details: always
  83. endpoints:
  84. web:
  85. exposure:
  86. # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点
  87. include: "*"
  88. ```