增加 actuate 示例

This commit is contained in:
YunaiV
2019-12-21 10:28:25 +08:00
parent 1fb91439a5
commit ff43301283
5 changed files with 58 additions and 16 deletions

View File

@@ -0,0 +1,18 @@
package cn.iocoder.springboot.lab34.actuatordemo.config;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.boot.actuate.info.SimpleInfoContributor;
import org.springframework.context.annotation.Bean;
import java.util.Collections;
//@Configuration
public class ActuateConfig {
@Bean
public InfoContributor exampleInfo() {
return new SimpleInfoContributor("example",
Collections.singletonMap("key", "value"));
}
}

View File

@@ -0,0 +1,17 @@
package cn.iocoder.springboot.lab34.actuatordemo.demo;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import java.util.Collections;
//@Component
public class DemoInfoContributor implements InfoContributor {
@Override
public void contribute(Info.Builder builder) {
builder.withDetail("demo",
Collections.singletonMap("key", "value"));
}
}

View File

@@ -0,0 +1 @@
build.test=@java.version@

View File

@@ -1,11 +1,17 @@
management:
endpoint:
# Info 端点配置项
info:
enabled: true
enabled: true # 是否开启。默认为 true 开启。
info:
#
git:
enabled: true
mode: simple
mode: full
build:
enabled: true
env:
enabled: true
endpoints:
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
@@ -14,15 +20,12 @@ management:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
#
info:
app:
java:
source: 1.8
target: 1.8
encoding: UTF-8
build:
java:
source: @java.version@
target: @java.version@
encoding: UTF-8
version: @project.version@

View File

@@ -1,11 +1,17 @@
management:
endpoint:
# Info 端点配置项
info:
enabled: true
enabled: true # 是否开启。默认为 true 开启。
info:
#
git:
enabled: true
mode: simple
mode: full
build:
enabled: true
env:
enabled: true
endpoints:
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
@@ -14,15 +20,12 @@ management:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
#
info:
app:
java:
source: 1.8
target: 1.8
encoding: UTF-8
build:
java:
source: 1.8.0_144
target: 1.8.0_144
encoding: UTF-8
version: 2.2.2.RELEASE