Knapsack AlgoV1
Knapsack AlgoV1

Reputation: 11

How to map Map<String, Map<String, String>> from application.yml in micronaut

I have some configuration in my application.yml as below

  nested:
    property1:
      key1: value1
      key2: value2
    property2:
      keyA: valueA
      keyB: valueB

Here i give a input like

input1: property1 input2: key2 output: value

I am trying to map this into Map<String, Map<String, String>> nested so that i can do nested.get("input1").get("input2") to get my output

I tried below but no luck. Any help would be appreciated

public class Props {
    @Property(name = "nested")
    @MapFormat(keyFormat = StringConvention.RAW)
    Map<String, Map<String, String>> nested = new HashMap<>();
}

Upvotes: 0

Views: 68

Answers (0)

Related Questions