Spring Boot has many useful features including externalized configuration and easy access to properties defined in properties files. An earlier tutorial described various ways in which this could be done.
We are now going to explore the @ConfigurationProperties annotation in greater detail.
Managing the lifecycle of Spring Boot Application is very important for a production-ready system. The Spring container handles the creation, initialization, and destruction of all the Beans with the help of the ApplicationContext.
The emphasize of this write-up is the destruction phase of the lifecycle. More specifically, we’ll have a look at different ways to shut down a Spring Boot Application.
In our previous guide to @ConfigurationProperties, we learned how to set up and use the @ConfigurationProperties annotation with Spring Boot for working with external configuration.
In this tutorial, we’ll show how to test configuration classes that rely on the @ConfigurationProperties annotation to make sure that our configuration data is loaded and bound correctly to their corresponding fields.
Collectors were added in Java 8 which helped accumulate input elements into mutable containers such as Map, List, and Set.
In this article, we’re going to explore two new collectors added in Java 9: Collectors.filtering andCollectors.flatMapping used in combination with Collectors.groupingBy providing intelligent collections of elements.
The Collectors.filtering is similar to the Stream filter(); it’s used for filtering input elements but used for different scenarios. The Stream’sfilter is used in the stream chain whereas the filtering is a Collector which was designed to be used along with grouping By.
With Stream’sfilter, the values are filtered first and then it’s grouped. In this way, the values which are filtered out are gone and there is no trace of it. If we need a trace then we would need to group first and then apply filtering which actually the Collectors.filtering does.