Table of Contents
SpringBoot2 new feature custom endpoint
Start the springboot project

1

management.endpoints.enabled-by-default: false

Copy after login
" >

1

management.endpoints.enabled-by-default: false

Copy after login
Home Java javaTutorial How to customize the endpoint in SpringBoot2

How to customize the endpoint in SpringBoot2

May 12, 2023 am 08:40 AM
springboot

SpringBoot2 new feature custom endpoint

1

2

3

4

5

6

7

8

9

10

11

12

13

package com.yan.otlan.springboot;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;

import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;

import org.springframework.boot.actuate.endpoint.annotation.Selector;

import org.springframework.stereotype.Component;

@Endpoint(id = "customPoint")

@Component

public class StatusEndPoint {

    @ReadOperation

    public String getCustom(@Selector String name) {

        return "MyName is ." + name;

    }

}

Copy after login

Only requires three annotations @endpoint, @ReadOperation, @Selector

Start the springboot project

How to customize the endpoint in SpringBoot2

Seeing the red mapped indicates success

Visit http://127.0.0.1:8080/actuator/customPoint /156

Result

How to customize the endpoint in SpringBoot2

##SpringBoot-Actuator-Custom endpoint properties

Close all endpoints

1

management.endpoints.enabled-by-default: false

Copy after login

Modify access Project path

The default access path is /actuator, which can be modified by modifying the following properties

1

management.endpoints.web.base-path: /actuator

Copy after login
For example, the default access path is

http://ip:port/actuator

If you want to change the access path to

http://ip:port/myActuator

, you can set the property to

/myActuator

The path must start with /, otherwise it cannot be accessed

The above is the detailed content of How to customize the endpoint in SpringBoot2. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How Springboot integrates Jasypt to implement configuration file encryption How Springboot integrates Jasypt to implement configuration file encryption Jun 01, 2023 am 08:55 AM

How Springboot integrates Jasypt to implement configuration file encryption

How SpringBoot integrates Redisson to implement delay queue How SpringBoot integrates Redisson to implement delay queue May 30, 2023 pm 02:40 PM

How SpringBoot integrates Redisson to implement delay queue

How to use Redis to implement distributed locks in SpringBoot How to use Redis to implement distributed locks in SpringBoot Jun 03, 2023 am 08:16 AM

How to use Redis to implement distributed locks in SpringBoot

How to solve the problem that springboot cannot access the file after reading it into a jar package How to solve the problem that springboot cannot access the file after reading it into a jar package Jun 03, 2023 pm 04:38 PM

How to solve the problem that springboot cannot access the file after reading it into a jar package

Comparison and difference analysis between SpringBoot and SpringMVC Comparison and difference analysis between SpringBoot and SpringMVC Dec 29, 2023 am 11:02 AM

Comparison and difference analysis between SpringBoot and SpringMVC

How SpringBoot customizes Redis to implement cache serialization How SpringBoot customizes Redis to implement cache serialization Jun 03, 2023 am 11:32 AM

How SpringBoot customizes Redis to implement cache serialization

How to get the value in application.yml in springboot How to get the value in application.yml in springboot Jun 03, 2023 pm 06:43 PM

How to get the value in application.yml in springboot

How to implement Springboot+Mybatis-plus without using SQL statements to add multiple tables How to implement Springboot+Mybatis-plus without using SQL statements to add multiple tables Jun 02, 2023 am 11:07 AM

How to implement Springboot+Mybatis-plus without using SQL statements to add multiple tables

See all articles