Developing Java Applications with Spring and Spring Boot
by Claudio Eduardo de Oliveira, Greg L. Turnquist, Alex Antonov
How it works...
The magic behind this functionality is actually very simple. Let's start from the separate configuration class and work our way to the filter bean detection.
If we look in our main class, BookPubApplication, we will see that it is annotated with @SpringBootApplication, which in turn is a convenience meta-annotation that declares @ComponentScan among others. We discussed this in detail in one of our earlier recipes. The presence of @ComponentScan instructs Spring Boot to detect WebConfiguration as a @Configuration class and add its definitions to the context. So, anything that we will declare in WebConfiguration is as good as if we were to put it right in BookPubApplication itself.
The @BeanpublicRemoteIpFilterremoteIpFilter() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access