In a Spring Boot application, how can you prevent a controller method from being exposed over HTTP?

  • Configuring it in the application.properties file.
  • Placing the controller class in a specific package.
  • There is no way to prevent a controller method from being exposed over HTTP in Spring Boot.
  • Using the @NoHttpExpose annotation.
To prevent a controller method from being exposed over HTTP in a Spring Boot application, you can configure it in the application.properties file by setting the appropriate properties. Using the @NoHttpExpose annotation is not a standard Spring Boot feature. Placing the controller class in a specific package does not control HTTP exposure. However, by default, only the controllers in the same or sub-packages of the main application class are scanned and exposed over HTTP.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *