Suppose you are trying to do something like:
@Bean
public MyConfiguration myConfiguration() throws IOException {
ObjectMapper yamlMapper = new ObjectMapper(new YAMLFactory());
return yamlMapper.readValue(new File("configuration.yml"), MyConfiguration.class);
}
But the output is something like:
com.fasterxml.jackson.databind.exc.MismatchedInputException
There are at least two reasons:
- Configuration file does not exist;
- Setters for
MyConfiguration.class
are named incorrectly or cannot be accessed.
If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.