Spring Boot for Microservices: Operation
Spring Boot also has some interesting approaches for operation.
- To deploy a Spring Boot application, it is enough to just copy the JAR file to the server and start it. Deploying a Java application can’t be further simplified.
- Spring Boot offers numerous options for the configuration. For example, a Spring Boot application can read the configuration from a configuration file or from an environment variable. Spring Cloud offers support for Consul as a server for configurations. The examples in this course use
application.propertiesfiles for configuration because they are relatively easy to handle.
- Spring Boot applications can generate logs in many different ways. Usually, a Spring Boot application displays the logs in the console. Output to a file is also possible. A Spring Boot application can also send the logs as JSON data to a central server instead of using a simple human-readable text format. JSON facilitates the processing of log data on this server.
- For metrics, Spring Boot offers a special starter, namely the Actuator. After adding a dependency to spring-boot-starter-actuator, the application collects metrics, for example about the HTTP requests. In addition, Spring Boot Actuator provides REST endpoints under which the metrics are available as JSON documents.