使用 application.properties 中配置的属性,举例:@Value("${server.port}")
时间:2019-09-11 12:24:29
收藏:0
阅读:404
使用 application.properties 中配置的属性:@Value 注解。
@RestController
public class HelloWorldController {
@Value("${server.port}")
String port;
@RequestMapping(value = "hi")
public String hello(){
return "hello world! I am from " + port;
}
}
原文:https://www.cnblogs.com/cag2050/p/11505086.html
评论(0)