方法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;

相关文章:

  • 2021-09-01
  • 2021-08-24
  • 2022-01-01
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2021-08-10
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2021-08-07
  • 2022-02-09
  • 2022-12-23
  • 2021-09-23
相关资源
相似解决方案