Fiz o registros das duas aplicações no eureka:
<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_2_</apps__hashcode>
<application>
<name>LOJA</name>
<instance>
<instanceId>10.13.23.69:loja:9080</instanceId>
<hostName>10.13.23.69</hostName>
<app>LOJA</app>
<ipAddr>10.13.23.69</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">9080</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1574766976271</registrationTimestamp>
<lastRenewalTimestamp>1574767516371</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1574766975765</serviceUpTimestamp>
</leaseInfo>
<metadata>
<management.port>9080</management.port>
<jmx.port>60432</jmx.port>
</metadata>
<homePageUrl>http://10.13.23.69:9080/</homePageUrl>
<statusPageUrl>http://10.13.23.69:9080/actuator/info</statusPageUrl>
<healthCheckUrl>http://10.13.23.69:9080/actuator/health</healthCheckUrl>
<vipAddress>loja</vipAddress>
<secureVipAddress>loja</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1574766976272</lastUpdatedTimestamp>
<lastDirtyTimestamp>1574766975742</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>FORNECEDOR</name>
<instance>
<instanceId>10.13.23.69:fornecedor:9081</instanceId>
<hostName>10.13.23.69</hostName>
<app>FORNECEDOR</app>
<ipAddr>10.13.23.69</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">9081</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1574767241152</registrationTimestamp>
<lastRenewalTimestamp>1574767511190</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1574767240645</serviceUpTimestamp>
</leaseInfo>
<metadata>
<management.port>9081</management.port>
<jmx.port>60411</jmx.port>
</metadata>
<homePageUrl>http://10.13.23.69:9081/</homePageUrl>
<statusPageUrl>http://10.13.23.69:9081/actuator/info</statusPageUrl>
<healthCheckUrl>http://10.13.23.69:9081/actuator/health</healthCheckUrl>
<vipAddress>fornecedor</vipAddress>
<secureVipAddress>fornecedor</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1574767241152</lastUpdatedTimestamp>
<lastDirtyTimestamp>1574767240642</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
</applications>
Contudo quando tendo realizar a compra tenho a seguinte exceção:
"message": "I/O error on GET request for \"http://fornecedor/info/GO\": Operation timed out (Connection timed out); nested exception is java.net.ConnectException: Operation timed out (Connection timed out)",
Os arquivos estão assim:
Loja
@SpringBootApplication
public class LojaApplication {
@Bean
@LoadBalanced
public RestTemplate getRestTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(LojaApplication.class, args);
}
}
@Service
public class CompraService {
@Autowired
private RestTemplate client;
public void realiza(CompraDTO compraDTO) {
ResponseEntity<InfoFornecedorDTO> exchange = client.exchange(
"http://fornecedor/info/" + compraDTO.getEndereco().getEstado(),
HttpMethod.GET, null,
InfoFornecedorDTO.class);
System.out.println(exchange.getBody().getEndereco());
}
}