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

爱⌒轻易说出口 提交于 2021-01-29 06:45:42

问题


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 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:

But it doesn't work for map keys (I also would like to work for values, but this is much too far right now) 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

来源:https://stackoverflow.com/questions/65184803/autocompletion-in-yml-files-with-spring-configuration-doesnt-work-for-map-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!