package com.example.demo.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.demo.common.SysConfigs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("configs")
public class ConfigsController {
@Value("${url.ip}")
private String ip;
@Value("${url.port}")
private String port;
@Value("${url.protocol}")
private String protocol;
@Autowired
private SysConfigs sysConfigs;
@GetMapping("get-all")
public ResponseEntity
getAll() {
JSONObject json =new JSONObject();
json.put("str", sysConfigs.getStr());
json.put("map", sysConfigs.getMap());
json.put("list", sysConfigs.getList());
json.put("listMap", sysConfigs.getListMap());
json.put("url", protocol + "://" + ip + ":" + port);
return ResponseEntity.ok().body(json);
}
}