Reputation: 2226
I need to inject the Map<String, String> from the application.properties file in key-value format using Spring annotation @Value in Kotlin.
Upvotes: 1
Views: 943
Reputation: 2226
You can inject map from property file as below
example.map={key1:'value1',key2:'value2'}
Inject in Kotlin
@Value("#{\${example.map}}")
val myMap: Map<String, String> = mapOf()
Upvotes: 1