@RestController
@RequestMapping("/wkx1")
public class PropController {
@Autowired
// private Prop prop;
@GetMapping("/test")
public String[] getServerInfo(String label){
String[] arr = new String[2];
try {
Properties properties = PropertiesLoaderUtils.loadAllProperties("wkx.properties");
arr[0] = properties.getProperty("my.wkx.name");
arr[1] = properties.getProperty("my.wkx2.address");
}catch (IOException ioe){
ioe.printStackTrace();
}
return arr;
}
}
wkx.properties:
my.wkx.name=veis
my.wkx1.password=123456
my.wkx2.address=china