educative.io

Output of example of Proxy

Course :-1: The Complete Guide to Spring 5 and Spring Boot 2. Module “Spring In Depth”. TItle “Mixing Bean Scope”. Second Example output does not seem to be correct.

“Movie instances created:” shows currently as 3, while it should be 4.

First Instance:
ContentBasedFilter filter = appContext.getBean(ContentBasedFilter.class);
ContentBasedFIlter has movie instance which will get called - 1st instance.

Second,Third and Fourth Instance:
Movie movie1 = filter.getMovie();
Movie movie2 = filter.getMovie();
Movie movie3 = filter.getMovie();