```
package com.hengan.springboottest.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
//读取配置文件
@Value("${user.uname}")
private String uname;
@RequestMapping("/method1")
public String getProp(){
return "读取配置文件的第一种方式:通过Value注解 "+uname;
}
}
```
网友评论