...

/

Unit Testing for XML Context

Unit Testing for XML Context

Learn how to write a unit test that uses the XML configuration.

The @ContextConfiguration annotation is used to load Java as well as XML context. We created an XML application context file for the MovieRecommenderSystemApplication. here. The XML configuration file is reproduced here:

Press + to interact
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package=
"io.datajek.spring.basics.movierecommendersystem.lesson14" use-default-filters="false">
</context:component-scan>
<!-- enable detection of @Autowired annotation -->
<context:annotation-config/>
<bean id="filter"
class="io.datajek.spring.basics.movierecommendersystem.lesson14.ContentBasedFilter"/>
<bean id="filter2"
class="io.datajek.spring.basics.movierecommendersystem.lesson14.CollaborativeFilter"/>
<bean id="recommenderImpl" class=
"io.datajek.spring.basics.movierecommendersystem.lesson14.RecommenderImplementation"/>
</beans>

In this file, we have mentioned ...

Access this course and 1400+ top-rated courses and projects.