Ver código fonte

增加配置文件读取

tags/v1.0.0^2
林万龙 3 anos atrás
pai
commit
d2cb1faa30
1 arquivos alterados com 4 adições e 2 exclusões
  1. +4
    -2
      src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java

+ 4
- 2
src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java Ver arquivo

@@ -4,6 +4,7 @@ import com.alibaba.cloud.nacos.parser.NacosDataParserHandler;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.exception.NacosException;
import com.telpo.dipperposition.co.RzlAccount;
import com.telpo.dipperposition.config.PositionConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -27,7 +28,8 @@ import com.alibaba.nacos.api.config.listener.Listener;
@Slf4j
public class DipperPositionController {

@Autowired RzlAccount rzlAccount;
@Autowired
PositionConfig positionConfig;

@RequestMapping("/getPos")
public String getPos() throws NacosException, InterruptedException, IOException {
@@ -44,7 +46,7 @@ public class DipperPositionController {
// Map<String, Object> dataMap = NacosDataParserHandler.getInstance().parseNacosData(content,"yaml");
// return dataMap == null ? "" : (String)dataMap.get(positionId);

return rzlAccount.getHello();
return positionConfig.getHello();
//return "Helle world!"; //ContextLoader.getCurrentWebApplicationContext().toString();
}
}

Carregando…
Cancelar
Salvar