首页 > 代码库 > Spring Boot

Spring Boot

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMethod;

@RestController //等同于同时加上了@Controller和@ResponseBody
public class HelloControler {

//访问/hello或者/hi任何一个地址,都会返回一样的结果
@RequestMapping(value = http://www.mamicode.com/{"/hello","/hi"},method = RequestMethod.GET)
public String say(){
return "hi you!!!";
}
}

Spring Boot