部署spring mvc遇到的错误

本文详细解析了Spring MVC中路径映射的工作原理,包括DispatcherServlet如何处理GET请求,RequestMappingHandlerMapping如何查找对应的处理器方法,以及当未找到匹配路径时如何处理等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

10:49:23,400 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'Dispatcher' processing GET request for [/group/]
sionPattern=2018-06-21 10:49:23 [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] DispatcherServlet with name 'Dispatcher' processing GET request for [/group/]
  10:49:23,402 DEBUG RequestMappingHandlerMapping:304 - Looking up handler method for path /
sionPattern=2018-06-21 10:49:23 [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]-[DEBUG] Looking up handler method for path /
  10:49:23,403 DEBUG RequestMappingHandlerMapping:314 - Did not find handler method for [/]
sionPattern=2018-06-21 10:49:23 [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]-[DEBUG] Did not find handler method for [/]
  10:49:23,403  WARN PageNotFound:1147 - No mapping found for HTTP request with URI [/group/] in DispatcherServlet with name 'Dispatcher'
sionPattern=2018-06-21 10:49:23 [org.springframework.web.servlet.PageNotFound]-[WARN] No mapping found for HTTP request with URI [/group/] in DispatcherServlet with name 'Dispatcher'
  10:49:23,403 DEBUG DispatcherServlet:1000 - Successfully completed request

sionPattern=2018-06-21 10:49:23 [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] Successfully completed request


@Controller
@RequestMapping(value="/api")
public class HelloController {


 


@Controller
@RequestMapping(value="/api")
public class HelloController {

 

         @RequestMapping("/hello")
         public ModelAndView hello(){
        	 
        	       System.out.print("进来了");

                   ModelAndView mv =new ModelAndView();

                   mv.addObject("spring", "spring mvc");

                   mv.setViewName("hello");

                   return mv;

         }

}

@RequestMapping(value="/api")新增这个注解

然后新增访问路径新增api



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值