XML Application Configuration
Learn how to replace Spring annotations with XML configuration.
Let’s have a look at how to configure a Spring application using XML. We will remove annotations from our application altogether and use XML to define beans and dependencies.
For the code example shown in this lesson, we have created a sub-package called lesson14
inside the package io.datajek.spring.basics.movierecommendersystem
.
The package contains MovieRecommenderSystemApplication.java
, Filter.java
, ContentBasedFilter.java
, CollaborativeFilter.java
, and RecommenderImplementation.java
files copied from the previous lesson.
We will remove all annotations from the code. This includes the @Configuration
and @ComponentScan
annotations from the MovieRecommenderSystemApplication
class and @Component
, @Qualifier
, and @Autowired
annotations from RecommenderImplementation
, ContentBasedFilter
, and CollaborativeFilter
classes.
XML configuration file
The first step is creating an XML file ...