I'm currently trying to get integration tests running in our Spring MVC project. One of our components depends on the ViewResolver which gets autowired by Spring. It's configured in the test-context.xml:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
However, this gives me an NoUniqueBeanDefinitionException:
Caused by:
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.web.servlet.ViewResolver' available: expected single matching bean but found 2: org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.web.servlet.view.InternalResourceViewResolver#1
When I remove the InternalResourceViewResolver property from the test-context.xml, I get a
Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.web.servlet.ViewResolver' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
How can that happen?
Any help would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire