
There are resources online on how to achieve this, for example from. Provide a custom Converter for your use case.Something along the lines of the following may work. yml-file, Spring can parse them accordingly. A Pair is a simple data class having two values being first and second. Adjust your application.yml to conform to the form of Pair.You may provide a custom getter for the list. by calling map.toList(), see the official documentation. Simply parse as Map as outlined in the question and convert your Map to a List>, e.g.Thus, there are at least three solutions to your problem: Spring does support classes following Bean conventions however. Spring cannot know how to parse arbitrary classes in arbitrary ways. How can I achieve reading pairs of String,Int to a mutable list from application.yml?Īs far as I know Spring Boot does not support Pair of the kotlin-stdlib out-of-the-box. I have also tried the following annotations but to no avail. The code works if I change the type to Map but I need Pair due to implementation details. Reason: The elements ,user-parameters.knapsacks] were left unbound. However, this fails with the following error. In the application.yml file, I tried to use the following configuration. * Owners of the knapsacks and their capacity. I would like to read a list of pairs from application.yml file to a mutablelist. I am working on a Spring Boot project in Kotlin.
