Spring Endpoint Endpoint Boot Drive

I prototyped with Spring loading, where I added a dependency on spring-boot-starter-actuatorand spring-boot-starter-data-restand named my REST testing endpoint a tag /info. The application ran without any errors, however my endpoint could not be called, and the application returned 404 all the time.

After some time, I found out that the drive project contains a SAME endpoint /infoand basically redefines my user endpoint as RESTful, as I did not name it.

My question is: is there a way to prevent this behavior at all (what does a bean mean by running into error)? Or at least get a WARN message when this happens.

Thanks in advance for your answers.

+4
source share
2 answers

Yes, it’s possible to disable specific classes with the help of @EnableAutoconfigurationthe parameter exclude=, where you can specify the class name or the entire package using {} brackets

Example:

  • @EnableAutoConfiguration(exclude = {MyClassName.class}

  • @EnableAutoConfiguration(exclude = {MyClassName.class, MyClassName2.class})

+1
source

You can disable the endpoint of the actuator /infousing the following property:

endpoints.info.enabled=false

In fact, everything can be turned off, or you can turn on only some of them if you check the source link below;

, , . "" , endpoints.enabled.

beans, , . , .

+1

Source: https://habr.com/ru/post/1672327/


All Articles