首页 > 移动平台 > 详细

Spring Boot—07应用application.properties中的配置

时间:2018-04-23 19:24:26      阅读:210      评论:0      收藏:0      [点我收藏+]


方法1

@Value("${test.msg}")  
    private String msg;


方法2

@Autowired  
private Environment env;
String value = env.getProperty("test.msg");


方法3

@RequestMapping(path="/${query.all}.json", method=RequestMethod.GET)
@ResponseBody
public List<User> all() {
    return userService.allUser();
}


方法4

@Component  
@ConfigurationProperties(prefix = "author",locations = "classpath:author.properties")     
public class MyWebConfig{  
    private String name;  
    private int age;

Spring Boot—07应用application.properties中的配置

原文:https://www.cnblogs.com/gispathfinder/p/8921103.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!