Decoupling Components
Explore how to decouple components in a Spring application by using interfaces and dependency injection. Understand how to make the RecommenderImplementation class independent of specific filter implementations, allowing dynamic selection of algorithms without changing core code.
We'll cover the following...
Right now, the RecommenderImplementation class is hard coded to use the ContentBasedFilter class. If we need to change the way our application recommends movies, we will need to change the code of the RecommenderImplementation class.
Say, we want to switch from content based filter to collaborative filter and take into account the preferences of users having a similar watch history.
We have created a sub-package called
lesson2inside theio.datajek.spring.basics.movierecommendersystempackage for the code example shown in this lesson.The package contains theMovieRecommenderSystemApplication.java,RecommenderImplementation.java, andContentBasedFilter.javafiles from the ...