
Spring Boot Actuator
coding三月 25, 20211mins
Spring Boot Java
EndpointsH1
Spring Boot默认包含的Endpoints。默认情况下除了shutdown,所有的Endpoint都是启用的。
InfoH2
应用信息通过InfoEndpoint 暴露,实现了InfoContributor 接口的类的信息会被暴露出来。Spring Boot默认配置了
- EnvironmentInfoContributor Exposes any key from the Environment under the info key
- GitInfoContributor Exposes git information if a git.properties file is available
- BuildInfoContributor Exposes build information if a META-INF/build-info.properties file is available.
EnvironmentInfoContributorH3
java
info.app.encoding=UTF-8info.app.java.source=11info.app.java.target=11
GitInfoContributorH3
插件会生成git.properties
java
plugins {id "com.gorylenko.gradle-git-properties" version "2.2.4"}
BuildInfoContributorH3
Spring Boot插件会生成build-info.properties
java
springBoot {buildInfo()}
暴露EndpointsH1
虽然Endpoints默认几乎都是暴露的,但是主要是通过JMX暴露的,Web的方式只暴露了health和info
通过配置设置暴露了endponits
java
management.endpoints.web.exposure.include=*management.endpoints.web.exposure.exclude=env,beans
访问权限H1
如果集成了Spring Security默认情况下,用户需要被授权
java
@Beanpublic SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests((requests) ->requests.anyRequest().hasRole("ENDPOINT_ADMIN"));http.httpBasic();return http.build();}
评论
新的评论
上一篇
小程序跨平台
React小程序运行时 原理 小程序的渲染层和逻辑层分别由两个线程管理:渲染层的界面使用 WebView 进行渲染;逻辑层采用 JSCore 运行 JavaScript 代码。一个小程序存在多个界面,所以渲染层存在多个 WebView。这两个线程间的通信经由小程序 Native…
下一篇
Python 构建系统
包管理 Conda是个跨语言的二进制环境、包管理器。 MiniConda、Anaconda是Conda的发行版本(安装器),MiniConda是Anaconda是只包含conda, Python以及它们的依赖的简化版本。 MiniForge是社区(conda-forge)驱动的…
