1

I have written a Spring-Boot version 2, Custom Endpoint actuator code and trying to make it navigable using @Selector option,

1) when I enter the URL http://localhost/actuator/notes/1.0 in the browser, its giving me 400 as error code and the expected output should be ** Version 1.0 **

2) when I enter the URL http://localhost/actuator/notes in the browser, its giving me expected output which is ** Version 1.1 ** ** Version 1.0 **

@Component
@Endpoint(id="notes")
public class NotesEndPoint {
     String notesOne=" ** Version 1.0 ** ";
     String notesTwo = "** Version 1.1 **";

     @ReadOperation
     public String selectNotes(@Selector String selector ) {
     if("1.0".equals(selector)) return notesOne ;
     else if("1.1".equals(selector)) return notesTwo ;
     else return getNotesVersion();
    }

    @ReadOperation
    public String getNotesVersion(){
    return notesTwo + notesOne;
    }

}

Karthik P
  • 11
  • 2

0 Answers0