This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> list = new ArrayList<String>(); | |
list.add("hello"); | |
String s = list.get(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> list = new ArrayList<String>(); | |
list.add("hello"); | |
list.add(32);//Compile Time Error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Global": { | |
"NewConfirmed": 257886, | |
"TotalConfirmed": 17849120, | |
"NewDeaths": 5615, | |
"TotalDeaths": 685038, | |
"NewRecovered": 222627, | |
"TotalRecovered": 10552934 | |
}, | |
"Countries": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19.domain; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import lombok.Data; | |
import java.util.List; | |
@Data | |
@JsonInclude(JsonInclude.Include.NON_NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19.domain; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import lombok.Data; | |
@Data | |
@JsonInclude(JsonInclude.Include.NON_NULL) | |
public class Global { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19.domain; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import lombok.Data; | |
@Data | |
@JsonInclude(JsonInclude.Include.NON_NULL) | |
public class Country { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19; | |
import com.rest.api.covid19.domain.Country; | |
import com.rest.api.covid19.domain.Covid19Statistics; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.boot.ApplicationArguments; | |
import org.springframework.boot.ApplicationRunner; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.web.client.RestTemplate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Signature of the HttpClient.get method | |
Mono<JsonObject> get(String url); | |
// The two urls to call | |
String firstUserUrl = "my-api/first-user"; | |
String userDetailsUrl = "my-api/users/details/"; // needs the id at the end | |
// Example with map | |
Mono<Mono<JsonObject>> result = HttpClient.get(firstUserUrl). | |
map(user -> HttpClient.get(userDetailsUrl + user.getId())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
postgres: | |
container_name: container-postgresdb | |
image: postgres | |
hostname: postgres | |
ports: | |
- "6543:5432" | |
environment: | |
POSTGRES_USER: postgres |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Step 1- create a docker bridge network database-network " | |
docker network create database-network | |
echo "Step 2- create a docker conatiner: container-postgresdb " | |
docker run --detach \ | |
--network database-network \ | |
--name container-postgresdb \ | |
--publish 5432:5432 \ | |
--env POSTGRES_USER=postgres \ | |
--env POSTGRES_PASSWORD=admin \ |