We have a web application that we would like to run in 'batch' mode, in this mode we dont want any endpoints exposed (for security reasons).
Is this possible in SpringBoot ?
We have a web application that we would like to run in 'batch' mode, in this mode we dont want any endpoints exposed (for security reasons).
Is this possible in SpringBoot ?
I'd recommend you use profiles on @Controller
or @RestController
classes:
@Profile("!batch")
@RestController
public class SomeController {
...
}
This means, SomeController
will be created for the application, if the profile is anything but batch
.
Then, you can run without batch
profile and have the endpoints; or activate the profile via property, environment or from command line with the batch
profile:
java -jar some-app.jar --spring.profiles.active=batch
See Spring API docs for details on how to define and activate profiles