Running Multiple Spring Boot Services with Docker Compose
In this post we'll look at how Docker Compose makes it easier to configure and run multiple containers in your local environment. Why Docker Compose? First up, you don't need Docker compose to run multiple containers. You can do this just fine by manually starting and stopping the containers [...]
Spring RestTemplate Request & Response Logging
It's sometimes useful to log HTTP requests and responses when working with a Spring RestTemplate. If you need fine-grained control over exactly what's logged you can use a custom interceptor to add logging before and after the remote call. Creating an Interceptor You'll need to create a class that [...]
Configuring a Custom ObjectMapper for Spring RestTemplate
Configuring a Custom ObjectMapper for Spring RestTemplate One of the great things about RestTemplate is its simplicity. You simply instantiate it like this... RestTemplate restTemplate = new RestTemplate(); and off you go. Under the hood Spring automatically creates and registers a number of message converters to handle various data [...]
Jackson JSON Deserialization – UnrecognizedPropertyException
Whats the Problem? I ran into a UnrecognizedPropertyException today trying to deserialize the following JSON. { "Places": [{ "PlaceId": "LOND-sky", "PlaceName": "London", "CountryId": "UK-sky", "RegionId": "", "CityId": "LOND-sky", "CountryName": "United Kingdom" }, { "PlaceId": "LHR-sky", "PlaceName": "London Heathrow", "CountryId": "UK-sky", "RegionId": "", "CityId": "LOND-sky", "CountryName": "United Kingdom" }] } [...]
Build, Package and Run Spring Boot Apps with Docker
I've recently started playing around with Docker again and have decided to put together a few posts to share what I've learned. In this post I'll show you how to compile, package and run a simple Spring Boot app in a Docker container. To keep the Docker image as [...]
Be Nice – Comment your Code
I've always been a fan of commenting code. To me, it's a no brainer, the sensible thing to do, and a fundamental part of building software that's easy to understand and maintain. Not everyone agrees though. Some argue that comments are unnecessary and simply shine a light on code [...]