1:更换Maven默认中心仓库的方法
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
2:相关代码
@RestController//返回json,@Controller返回view
@RequestMapping("/hello") // 可以省略
public class HelloController {
@Autowired
private GirlProperties girlProperties;
@RequestMapping(value="say",method = RequestMethod.GET)
public String say(){
return girlProperties.getCupSize();
// return "index";//配合@Controller使用返回view
}
// @RequestMapping(value="/sayy",method = RequestMethod.GET)
@GetMapping(value="/sayy")
public String sayy(@RequestParam(value="id",required = false,defaultValue = "0") Integer myId){
return "id:"+myId;
}
}
@Component
@ConfigurationProperties(prefix = "girl")
public class GirlProperties {
private String cupSize;
private Integer age;
public String getCupSize() {
return cupSize;
}
public void setCupSize(String cupSize) {
this.cupSize = cupSize;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}