mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 05:53:54 +08:00
增加 actuate 示例
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
build.test=@java.version@
|
||||
@@ -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@
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user