Originally posted by Jason Nesbitt:
I'm not mapping to /news* anywhere. The context of the application is ROOT (/) and the war file is not named news.war. The mapping strategy I'm using is org.springframework.web.servlet.handler.SimpleUrlHandlerMapping. Based on what you said I'm guessing that it's trying to infer mapping urls from the class names. I'm guessing the confusion then arises because two beans have the same class. I didn't know that this handler behaved like this. Is there one that I can use which doesn't infer any mapping urls?
Not that particular Handler, but there is a BeanName handler that is a default handler given to you, that if it can't find the URL mapping via the other Handlers, then it will use it.
From the Spring JavaDocs for the DispatcherServlet
It can use any HandlerMapping implementation - pre-built or provided as part of an application - to control the routing of requests to handler objects. Default is BeanNameUrlHandlerMapping, as well as a DefaultAnnotationHandlerMapping when running on Java 5+. HandlerMapping objects can be defined as beans in the servlet's application context, implementing the HandlerMapping interface, overriding the default HandlerMapping if present. HandlerMappings can be given any bean name (they are tested by type).
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/servlet/DispatcherServlet.html So I agree with you about the conflict. So then the question is, do you need to have two bean definitions for the same controller?
Mark