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

少年辛苦终身事,莫向光阴惰寸功。这篇文章主要讲述Spring Boot— 07应用application.properties中的配置相关的知识,希望能为你提供帮助。


方法1

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



【Spring Boot— 07应用application.properties中的配置】方法2
@Autowired private Environment env; String value = https://www.songbingjia.com/android/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;






    推荐阅读