redis, rtcp服务地址配置化
This commit is contained in:
parent
c99e56c682
commit
f9e1df0000
|
@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.core.*;
|
||||
|
@ -50,6 +51,8 @@ public class Redis2DBPersistenceService {
|
|||
private JdbcTemplate jdbcTemplate;
|
||||
@Resource(name = "stringRedisTemplate")
|
||||
private RedisTemplate redisTemplate;
|
||||
@Value("${app.modbus-rtcp-host:http://localhost:9999}")
|
||||
private String modbusRtcpHost;
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
@Resource
|
||||
|
@ -145,7 +148,7 @@ public class Redis2DBPersistenceService {
|
|||
|
||||
private void writeOnlineGateway() {
|
||||
try {
|
||||
RequestEntity request = RequestEntity.get("http://localhost:9999/modbus-tcp/online").build();
|
||||
RequestEntity request = RequestEntity.get(this.modbusRtcpHost + "/modbus-tcp/online").build();
|
||||
ResponseEntity<Response<List<String>>> response = this.restTemplate.exchange(request,
|
||||
new ParameterizedTypeReference<Response<List<String>>>() {
|
||||
});
|
||||
|
|
|
@ -14,5 +14,8 @@ spring:
|
|||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:172.17.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
port: ${REDIS_PORT:56379}
|
||||
database: ${REDIS_DATABASE:1}
|
||||
|
||||
app:
|
||||
modbus-rtcp-host: http://172.17.0.1:9999
|
||||
|
|
Loading…
Reference in New Issue