Question: I have a Dictionary that includes both key and value as strings. What I'm doing is I stored a word set with definition as Key as the word and definition as value. There are around 100 items in the dictionary. I'm creating a game in unity to select a word from the puzzle and player have to answer for a question that weather the definition is true or false. So now I select the value from whole dictionary which make the probability of getting true as the answer is 1%. I want to select 5 values from the dictionary including the correct answer and select randomly from that list or array.

This is how I initialized my dictionary.

```
public Dictionary<string, string> def = new Dictionary<string, string>(){
{"word1","definition1"},
{"word1","definition1"},
{"word1","definition1"}...
};

```

Can anyone help me out to solve this?

Thank you.

Answer: 
**Rest Template** is used to create applications that consume RESTful Web Services. You should declare a Bean for Rest Template to auto wiring the Rest Template object:

```
@Configuration
public class RestClientConfiguration {

    // First Method: default
    @Bean
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

    // Second Method: Using RestTemplateBuilder
    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }
}

```

You can declare it also inside your SpringBootApplication class:

```
@SpringBootApplication
public class MyApplication {
   public static void main(String[] args) {
      SpringApplication.run(MyApplication.class, args);
   }
   @Bean
   public RestTemplate getRestTemplate() {
      return new RestTemplate();
   }
}

```
Create a bean of Rest template in Configuration class as shown below

```
@Bean public RestTemplate restTemplate(){ return new RestTemplate(); }

```

then Autowire it wherever you want to use this.

```
@Autowired
private RestTemplate restTemplate;

```