Autocompletion in YML files with Spring configuration doesn't work for map field

962 Views Asked by At

I'm facing some issues with autocompletion feature for yml files containing spring configuration. I found very similar question on stackoverflow but my reputation is too low to write a comment there. The solution doesn't work for me.

I enabled annotation processor enter image description here I'm using the newest Ultimate version of IntelliJ.

I added the following dependency to my pom.xml file:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
</dependency>

I have two classes:

public class BooProperties {
    private int workerCount;
    // getters and setters
}

and:

@ConfigurationProperties("server.worker")
public class FooProperties {
    private int workerCount;
    private int subWorkerCount;
    private int limit;
    @NestedConfigurationProperty
    private Map<String, BooProperties> group = new HashMap<>();
    // getters and setters
}

My whole project can be found here in github.

Autocompletion works generally: enter image description here

But it doesn't work for map keys (I also would like to work for values, but this is much too far right now) enter image description here Despite I added file additional-spring-configuration-metadata.json:

{
  "properties":[{
    "name": "server.worker.group",
    "type":"java.util.Map<java.lang.String, com.BooProperties>",
    "description": ".....",
    "sourceType":"com.FooProperties"
  }],
  "hints":[{
    "name":"server.worker.group.keys",
    "values": [
      {
        "value": "1"
      },
      {
        "value": "2"
      }
    ]
  }]
}

I'm stuck. I cannot find any material about that on the Internet.

Best regards

0

There are 0 best solutions below