springboot ResetController RequestMapping 注解
11
@ResetController
代表这个类 是REST风格的控制器,返回JSON/XML类型的数据
@RequestMapping
配置URL和方法之间的映射。可注解在类和方法上。
注解在方法上的RequestMapping 路径会继承注解在类上的路径
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {@RequestMapping("/hello")public String hello() throws Exception{return "HelloWorld ,Spring Boot!";}
}