@@ -3,6 +3,8 @@ package com.telpo.dipperposition.co; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.ToString; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Lazy; | |||
import org.springframework.stereotype.Component; | |||
/** | |||
@@ -11,11 +13,30 @@ import org.springframework.stereotype.Component; | |||
* @author: king | |||
* @create: 2021-01-12 14:02 | |||
**/ | |||
@Lazy | |||
@Getter | |||
@Setter | |||
@ToString | |||
@Component | |||
public class RzlAccount { | |||
@Value("${hello}") | |||
private String hello; | |||
RzlAccount() | |||
{ | |||
} | |||
private static RzlAccount instance; | |||
public static RzlAccount getInstance(){ | |||
if (instance==null){ | |||
try { | |||
Thread.sleep(100); | |||
} catch (InterruptedException e) { | |||
e.printStackTrace(); | |||
} | |||
instance = new RzlAccount(); | |||
} | |||
return instance; | |||
} | |||
} |
@@ -28,8 +28,7 @@ import com.alibaba.nacos.api.config.listener.Listener; | |||
@Slf4j | |||
public class DipperPositionController { | |||
@Autowired | |||
PositionConfig positionConfig; | |||
RzlAccount rzlAccount; | |||
@RequestMapping("/getPos") | |||
public String getPos() throws NacosException, InterruptedException, IOException { | |||
@@ -45,8 +44,7 @@ public class DipperPositionController { | |||
// //log.info(positionId + ":" + content.positionId) | |||
// Map<String, Object> dataMap = NacosDataParserHandler.getInstance().parseNacosData(content,"yaml"); | |||
// return dataMap == null ? "" : (String)dataMap.get(positionId); | |||
return positionConfig.getHello(); | |||
return RzlAccount.getInstance().getHello(); | |||
//return "Helle world!"; //ContextLoader.getCurrentWebApplicationContext().toString(); | |||
} | |||
} |