Suppose I'm trying to declare a bean in my dispatcher-servlet.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
...
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
...
</beans>
But here's the problem: in my own project, I've got a package named exactly org.springframework.web.servlet.view
and in that package, I don't have the same classes as Spring does. What this does is it "confuses" Spring and as such, looks for the class in my project but I want it to fetch the class from the Spring libraries/jars. This results in an error along the lines of that it can't find the class. How can I tell Spring to look at its own classes and not mine?
I can't tell you how odd this is, but in my project, even my IDE can't tell where the class definition is. But in another project, I've tried yet it still works.