为了账号安全,请及时绑定邮箱和手机立即绑定

前面都能正常执行到这里卡住了,无法启动成功

前面都能正常执行到这里卡住了,无法启动成功

qq_无齿又怎样_0 2018-09-13 01:00:06
@RestController @RequestMapping("/hello") public class HelloController {    /* @Value("${cupSize}")     private String cupSize;     @Value("${age}")     private int age;     @Value("${content}")     private String content;*/     @Autowired     private GirlProperties girlProperties;     @GetMapping("/say/${id}")     public String say(@PathVariable("id")Integer id){         //return girlProperties.getCupSize();         //return "index";         return "id: " + id;     } }
查看完整描述

2 回答

已采纳
?
chandou

TA贡献22条经验 获得超11个赞

@GetMapping("/say/${id}")更改为@GetMapping("/say/{id}")

@GetMapping("/say/{id}")	
public String say(@PathVariable("id") Integer id) {		
    return "id=" + id;	
}

https://img1.sycdn.imooc.com//5b9a5c6c0001929306330279.jpg

查看完整回答
反对 回复 2018-09-13
?
qq_a沙漏中的时光_0

TA贡献13条经验 获得超2个赞

什么错?报什么异常

查看完整回答
反对 回复 2018-09-13
  • qq_无齿又怎样_0
    qq_无齿又怎样_0
    - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Invalid mapping on handler class [com.imooc.HelloController]: public java.lang.String com.imooc.HelloController.say(java.lang.Integer)
  • qq_无齿又怎样_0
    qq_无齿又怎样_0
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Invalid mapping on handler class [com.imooc.HelloController]: public java.lang.String com.imooc.HelloController.say(java.lang.Integer)
  • qq_无齿又怎样_0
    qq_无齿又怎样_0
    Caused by: java.lang.IllegalStateException: Invalid mapping on handler class [com.imooc.HelloController]: public java.lang.String com.imooc.HelloController.say(java.lang.Integer)
点击展开后面3
  • 2 回答
  • 0 关注
  • 2742 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信