Skip to content

Commit

Permalink
增加 actuate 示例
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Dec 21, 2019
1 parent ff43301 commit e3dfab0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,4 +17,9 @@ public InfoContributor exampleInfo() {
Collections.singletonMap("key", "value"));
}

@Bean
public InfoContributor exampleInfo02() {
return new MapInfoContributor(Collections.singletonMap("example02", "nicai"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ management:
info:
enabled: true # 是否开启。默认为 true 开启。
info:
#
git:
# EnvironmentInfoContributor 的配置项
env:
enabled: true
mode: full
# BuildInfoContributor 的配置属性
build:
enabled: true
env:
# GitInfoContributor 的配置属性
git:
enabled: true
mode: SIMPLE # Git 信息展示模式。SIMPLE 默认,只展示精简的 Git 版本信息;FULL 模式,展示完整的 Git 版本信息。

endpoints:
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
Expand All @@ -20,12 +22,12 @@ management:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
#

# info 配置项
info:
app:
java:
source: @java.version@
target: @java.version@
encoding: UTF-8
version: @project.version@

14 changes: 8 additions & 6 deletions lab-34/lab-34-actuator-demo-info/target/classes/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ management:
info:
enabled: true # 是否开启。默认为 true 开启。
info:
#
git:
# EnvironmentInfoContributor 的配置项
env:
enabled: true
mode: full
# BuildInfoContributor 的配置属性
build:
enabled: true
env:
# GitInfoContributor 的配置属性
git:
enabled: true
mode: SIMPLE # Git 信息展示模式。SIMPLE 默认,只展示精简的 Git 版本信息;FULL 模式,展示完整的 Git 版本信息。

endpoints:
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
Expand All @@ -20,12 +22,12 @@ management:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
#

# info 配置项
info:
app:
java:
source: 1.8.0_144
target: 1.8.0_144
encoding: UTF-8
version: 2.2.2.RELEASE

0 comments on commit e3dfab0

Please sign in to comment.