- Created a HelloWorld 'page' available at http://localhost:8080/test/
-
Generated project using https://start.spring.io/
-
Expose all endpoints
endpoints: web: exposure: include: "*"
-
For fun, changed base path to 'anything'
management: endpoints: web: base-path: /anything
-
Add info area to application.yml
info: app: version: 0.0.1 name: just anything we wish extra: this too java: version: ${java.version} author: name: abc
-
Add Extender for information (which would allow us to note other information desired at runtime)
Class ExtendedInfo does this by retrieving he existing info map and adding to it as well as using example of noting a status if desired
-
Allow shutdown to test this
management: endpoint: shutdown: enabled: true
By posting to shutdown endpoint, can shut down
curl -X POST http://localhost/anything/shutdown
-
Show all health
management: endpoint: health: show-details: always
-
Add CustomHealthIndicator
Shows just how simple the work here is
-
Adding a failure health through CustomFailingHealthIndicator just to show it
Micrometer is provided through Spring Boot as well, out of the box.
-
Created a MetricsConfig class
This configuration allows us to specify any number of tags that we wish. This particular example provides tags from application settings as well as fixed values.
-
Created custom metric through HelloService
By creating a custom Bean and then injecting the metrics registry, we can add any values we wish
We can also see the values at http://localhost:8080/anything/metrics/received.messages
I also used the @Slf4j annotation within the service simply to show how easy it is to log
-
Created a HealthMetrics metric
-
Created custom LogMeterRegistry that logs metrics from Micrometer into the spring log
By adding a bean to MetricsConfig, we can now run this application and see metrics in the console.
-
Added Stub generation
-
Enhanced Stub generation by generating some stubs through unit tests
-
Following H2 introduction at http://www.springboottutorial.com/spring-boot-and-h2-in-memory-database
Including access to http://localhost:8090/h2-console connecting to
jdbc:h2:mem:testdb
-
Added spring data rest to test out retrieval