diff --git a/src/main/java/com/telpo/dipperposition/DipperPositionApplication.java b/src/main/java/com/telpo/dipperposition/DipperPositionApplication.java index f25c92d..691fbb1 100644 --- a/src/main/java/com/telpo/dipperposition/DipperPositionApplication.java +++ b/src/main/java/com/telpo/dipperposition/DipperPositionApplication.java @@ -31,7 +31,6 @@ public class DipperPositionApplication { log.info("北斗定位服务开始!"); ConfigurableApplicationContext applicationContext = SpringApplication.run(DipperPositionApplication.class, args); log.info("北斗定位服务启动!"); - log.info(applicationContext.getResource("bootstrap.yaml").getFile().getAbsolutePath()); //启动服务端 ConfigurableEnvironment environment = applicationContext.getEnvironment(); DipperPositionServer nettyServer = new DipperPositionServer(environment); diff --git a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java index 326bc12..d6bd996 100644 --- a/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java +++ b/src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java @@ -13,7 +13,9 @@ import org.apache.logging.log4j.util.PropertiesUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.springframework.util.ResourceUtils; +import java.io.FileNotFoundException; import java.io.UnsupportedEncodingException; import java.util.List; @@ -46,11 +48,18 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS private String ipPositionRequestKey; // 从CSV文件读取省会城市中心点位置信息 - private void getPosFromFile(String centerAddress) { + private void getPosFromFile(String centerAddress) { // 不存在说明token是已过期了 String centerProvinceName = ""; String centerProvinceLonAndAlt = ""; - List centerAddressSets = CSVUtil.readCSV(this.centerProvinceFilePath); + String appResPath = ""; + try { + appResPath = ResourceUtils.getURL("resources:").getPath(); + log.debug(appResPath); + } catch (Exception e) { + log.debug("cannot find path"); + } + List centerAddressSets = CSVUtil.readCSV(appResPath + this.centerProvinceFilePath); for (String centerAddressSet:centerAddressSets) { String[] centerAddressSetArray = centerAddressSet.split(","); if (centerAddressSetArray.length < 3) {