@Controller("/UserAction")
@RequestMapping("/greet.json")
public class UserAction extends BaseAction {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public void hello(HttpServletRequest request,HttpServletResponse response) {
System.out.println("a");
}
@RequestMapping(value = "/word", method = RequestMethod.GET)
public void word(HttpServletRequest request,HttpServletResponse response) {
System.out.println("123123@@@");
}
}
when I look http://localhost:8080/ProjectName/greet.json/hello and http://localhost:8080/ProjectName/greet.json/word can't excute the syso method
Mapped "{[/greet.json],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public void cn.elfsoft.controller.UserAction.hello(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 08:33:38,488 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (org.springframework.beans.factory.support.DefaultSingletonBeanRegistry:433) - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4eed49c9: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,AnswerAction,FileResourceAction,SendMessageAction,SubjectAction,userAction,videoAction,baseDAO,FileResource,QuestionDao,SubjectDao,videoDao,FileResourceService,QuestionService,SubjectService,UserService,videoService,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.aop.config.internalAutoProxyCreator,cn.elfsoft.log.LogAdvice#0,dataSource,org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor#0,sessionFactory,jdbcTemplate,txManager,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,businessService,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy 08:33:38,490 ERROR [org.springframework.web.servlet.DispatcherServlet] (org.springframework.web.servlet.FrameworkServlet:460) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0' defined in ServletContext resource [/WEB-INF/web-config.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'userAction' bean method public void cn.elfsoft.controller.UserAction.word(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) to {[/greet.json],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'userAction' bean method public void cn.elfsoft.controller.UserAction.hello(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) mapped.