有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

带有Spring配置的YML文件中的java自动完成不适用于map字段

我在包含spring配置的yml文件的自动完成功能方面遇到了一些问题。我在stackoverflow上发现了非常类似的问题,但我的声誉太低,无法在那里发表评论。这个解决方案对我不起作用

我启用了注释处理器enter image description here 我正在使用IntelliJ的最新终极版本

我在我的pom.xml文件中添加了以下依赖项:

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

我有两门课:

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

以及:

@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
}

我的整个项目可以在here in github找到

自动补全通常适用于: enter image description here

但它不适用于映射键(我也希望适用于值,但现在这太远了) enter image description here 尽管我添加了文件^{

{
  "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"
      }
    ]
  }]
}

我卡住了。我在网上找不到任何有关这方面的资料

致意


共 (0) 个答案