A small spring boot and docker example with some intended mistakes to show how to work with docker.
In docker-compose there is no restart attribute so that after the BuyingRestService starts and PostConstruct invocates the setup method, the spring context will be destroyed because of a missing this-reference for the application context.
Solve with adding 'this.' in line 22.
In DemoDockerApplicationTests the Annotations to use the application context are commented. Just uncomment them.
In BuyingRestService line 37 there is a substring(-1) returned which results in a ArrayOutOfBoundsException. Just remove the substring method.