mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 05:53:54 +08:00
增加 actuate 示例
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package cn.iocoder.springboot.lab34.actuatordemo.config;
|
||||
|
||||
import org.springframework.boot.actuate.info.InfoContributor;
|
||||
import org.springframework.boot.actuate.info.MapInfoContributor;
|
||||
import org.springframework.boot.actuate.info.SimpleInfoContributor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
//@Configuration
|
||||
@Configuration
|
||||
public class ActuateConfig {
|
||||
|
||||
@Bean
|
||||
@@ -15,4 +17,9 @@ public class ActuateConfig {
|
||||
Collections.singletonMap("key", "value"));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InfoContributor exampleInfo02() {
|
||||
return new MapInfoContributor(Collections.singletonMap("example02", "nicai"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ package cn.iocoder.springboot.lab34.actuatordemo.demo;
|
||||
|
||||
import org.springframework.boot.actuate.info.Info;
|
||||
import org.springframework.boot.actuate.info.InfoContributor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
//@Component
|
||||
@Component
|
||||
public class DemoInfoContributor implements InfoContributor {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
build.test=@java.version@
|
||||
@@ -4,14 +4,16 @@ management:
|
||||
info:
|
||||
enabled: true # 是否开启。默认为 true 开启。
|
||||
info:
|
||||
#
|
||||
git:
|
||||
enabled: true
|
||||
mode: full
|
||||
build:
|
||||
enabled: true
|
||||
# EnvironmentInfoContributor 的配置项
|
||||
env:
|
||||
enabled: true
|
||||
# BuildInfoContributor 的配置属性
|
||||
build:
|
||||
enabled: true
|
||||
# GitInfoContributor 的配置属性
|
||||
git:
|
||||
enabled: true
|
||||
mode: SIMPLE # Git 信息展示模式。SIMPLE 默认,只展示精简的 Git 版本信息;FULL 模式,展示完整的 Git 版本信息。
|
||||
|
||||
endpoints:
|
||||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
|
||||
@@ -20,7 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
|
||||
#
|
||||
|
||||
# info 配置项
|
||||
info:
|
||||
app:
|
||||
java:
|
||||
@@ -28,4 +31,3 @@ info:
|
||||
target: @java.version@
|
||||
encoding: UTF-8
|
||||
version: @project.version@
|
||||
|
||||
|
||||
@@ -4,14 +4,16 @@ management:
|
||||
info:
|
||||
enabled: true # 是否开启。默认为 true 开启。
|
||||
info:
|
||||
#
|
||||
git:
|
||||
enabled: true
|
||||
mode: full
|
||||
build:
|
||||
enabled: true
|
||||
# EnvironmentInfoContributor 的配置项
|
||||
env:
|
||||
enabled: true
|
||||
# BuildInfoContributor 的配置属性
|
||||
build:
|
||||
enabled: true
|
||||
# GitInfoContributor 的配置属性
|
||||
git:
|
||||
enabled: true
|
||||
mode: SIMPLE # Git 信息展示模式。SIMPLE 默认,只展示精简的 Git 版本信息;FULL 模式,展示完整的 Git 版本信息。
|
||||
|
||||
endpoints:
|
||||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
|
||||
@@ -20,7 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
|
||||
#
|
||||
|
||||
# info 配置项
|
||||
info:
|
||||
app:
|
||||
java:
|
||||
@@ -28,4 +31,3 @@ info:
|
||||
target: 1.8.0_144
|
||||
encoding: UTF-8
|
||||
version: 2.2.2.RELEASE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user