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.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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</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. <spring-boot-admin.version>2.0.3</spring-boot-admin.version>
  24. </properties>
  25. <dependencies>
  26. <dependency>
  27. <groupId>org.springframework.boot</groupId>
  28. <artifactId>spring-boot-starter-web</artifactId>
  29. </dependency>
  30. <dependency>
  31. <groupId>de.codecentric</groupId>
  32. <artifactId>spring-boot-admin-starter-client</artifactId>
  33. </dependency>
  34. <dependency>
  35. <groupId>org.springframework.boot</groupId>
  36. <artifactId>spring-boot-starter-security</artifactId>
  37. </dependency>
  38. <dependency>
  39. <groupId>org.springframework.boot</groupId>
  40. <artifactId>spring-boot-starter-test</artifactId>
  41. <scope>test</scope>
  42. </dependency>
  43. </dependencies>
  44. <dependencyManagement>
  45. <dependencies>
  46. <dependency>
  47. <groupId>de.codecentric</groupId>
  48. <artifactId>spring-boot-admin-dependencies</artifactId>
  49. <version>${spring-boot-admin.version}</version>
  50. <type>pom</type>
  51. <scope>import</scope>
  52. </dependency>
  53. </dependencies>
  54. </dependencyManagement>
  55. <build>
  56. <finalName>spring-boot-demo-admin-client</finalName>
  57. <plugins>
  58. <plugin>
  59. <groupId>org.springframework.boot</groupId>
  60. <artifactId>spring-boot-maven-plugin</artifactId>
  61. </plugin>
  62. </plugins>
  63. </build>
  64. </project>
  65. ```
  66. ## application.yml
  67. ```yaml
  68. server:
  69. port: 8080
  70. servlet:
  71. context-path: /demo
  72. spring:
  73. application:
  74. # Spring Boot Admin展示的客户端项目名,不设置,会使用自动生成的随机id
  75. name: spring-boot-demo-admin-client
  76. boot:
  77. admin:
  78. client:
  79. # Spring Boot Admin 服务端地址
  80. url: "http://localhost:8000/admin"
  81. instance:
  82. metadata:
  83. # 客户端端点信息的安全认证信息
  84. user.name: ${spring.security.user.name}
  85. user.password: ${spring.security.user.password}
  86. security:
  87. user:
  88. name: xkcoding
  89. password: 123456
  90. management:
  91. endpoint:
  92. health:
  93. # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况
  94. show-details: always
  95. endpoints:
  96. web:
  97. exposure:
  98. # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点
  99. include: "*"
  100. ```

一个用来深度学习并实战 spring boot 的项目,目前总共包含 66 个集成demo,已经完成 55 个。

Contributors (1)