在项目中创建一个类,编写如下内容:
package com.f*iservice.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @ClassName FeiController * @Description * @Author chenfei * @Date 2019-07-12 16:50 **/ @RestController @RequestMapping("/f*i") public class FeiController { @GetMapping("/*f") public int getFei(){ return 1; } }
项目启动,在浏览器中访问,并返回如下内容:
SpringCloud实战——(3)通过RESTful方式调用模块的方法
原文:https://www.cnblogs.com/ratels/p/11177294.html