When a modern robust application has to deal with failures, it tries to continue operating gracefully keeping a normal external behaviour. Usually each of these failures are reported to a logging system in order that they can be monitorized. Not only failures are reported, any relevant event is logged with the same purpose.
As soon as you build an API including a few operations, you will realize that is hard to maintain code and documentation in sync. Therefore you can use a tool like Swagger. It can generate easly a high quality documentation for you.
Swagger is both a specification and a framework implementation. The strength of Swagger is its hability to keep in sync the code and the documentation. Once you integrate Swagger with your server app, it will generate a live RESTful documentation which will let you navigate and test without coding a single line.
How to integrate your Spring Boot Application with Swagger
First step: Enabling Swagger
Including this annotation in a configuration class
Only works for those spring beans present in the test class. If you need to inject the mock in every bean that depends on, you must declare and autowire all those beans ( although you do not require them ).
Mocks are injected after all the Spring initializations and post-processing. If you are using @PostConstruct, FactoryBean or similar, your mocks will be injected too late and will not be invoked.
An alternative is to use @MockedBean and @EnableMockedBean. By means of these annotations, mocks are created and directly injected into the Spring Context. The original beans are replaced by the mocks, before any initialization and post-processing happen.
Spring Boot supports the use of YAML files to externalize configuration. YAML is a superset of JSON, human-readable and very convenient for specifying hierarchical configuration data. This is an example of yaml
You may also want to use Spring Cloud ZooKeeper Config and having your configuration distributed along your cluster. To get it you have to create a tree structure of nodes in ZooKeeper that is equivalent to the content of your yaml configuration files. It can be done through creation scripts for zkCli but is easier to use zookeeperdump. Zookeeperdump is a tool intended to help loading configurations for Spring Cloud ZooKeeper Config.
It can be downloaded with this maven command.
Zookeeperdump is a groovy script which requires that groovy binaries have been installed previously in your system. I recommend the use of gvm for managing groovy tools and versions.
To view all the tool options execute zookeeperdump.groovy without parameters:
For example to import a yaml file into ZooKeeper is only needed this command.