1、Spring Boot的Controller使用
(1)@Controller ---处理http请求
(2)@RestController---Spring4之后新加的注解,原来返回json需要 @ResponseBody配合@Controller
(3)RequestMapping配置url映射
(4)PathVariable获取url中的数据
(5)RequestParam获取请求参数的值
(6)GetMapping 组合注解
2、案例GirlProperties.java(在src/main/java/com.example包中)
package com.example;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix="girl")
public class GirlProperties {
private String cupSize;
private Integer age;
public String getCupSize() {
return cupSize;
}
public GirlProperties setCupSize(String cupSize) {
this.cupSize = cupSize;
return this