@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@@@");
}
}
当我查看http://localhost:8080/ProjectName/greet.json/hello 和http://localhost:8080/ProjectName/greet.json/word 时无法执行 syso 方法
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]; 工厂层次结构的根 08:33:38,490 错误 [org.springframework.web.servlet.DispatcherServlet] (org.springframework.web.servlet.FrameworkServlet:460) - 上下文初始化失败 org.springframework.beans.factory.BeanCreationException:创建错误在 ServletContext 资源 [/WEB-INF/web-config.xml] 中定义的名称为 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0' 的 bean:调用 init 方法失败;嵌套异常是java。lang.IllegalStateException:发现不明确的映射。无法将 'userAction' bean 方法 public void cn.elfsoft.controller.UserAction.word(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 映射到 {[/greet.json],methods=[],params =[],headers=[],consumes=[],produces=[],custom=[]}: 已经有 'userAction' bean 方法 public void cn.elfsoft.controller.UserAction.hello(javax.servlet.http .HttpServletRequest,javax.servlet.http.HttpServletResponse) 映射。