有 Java 编程相关的问题?

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

java无法加载自定义应用程序的子集。Quarkus中映射的yml配置

我试图使用quarkus yaml扩展作为配置的主要来源,并试图找出从yaml文件加载映射的最佳方法

application.yml

quarkus:
  http:
    port: 8080
configuration:
  value:
    name1: test1
    name2: test2
    name3: test3

在代码中,我尝试像这样注入配置值:

@ConfigProperty(name = "configuration.value")
Values value;

其中的值包含一个自定义的Eclipse文件转换器。转换器如下所示:

public class ValueConverter implements Converter<Values> {
    @Override
    public Values convert(String value) {
        // Here there would be the actual code to convert to Map.
        return new Values(map);
    }
}

问题是字符串值为空,也就是说,它不会在配置下面加载stull。价值:

name1: test1
name2: test2
name3: test3

我还尝试过用@ConfigProperties(prefix = "configuration.value")注释一个类,并在里面有一个映射,但它不知道如何像预期的那样将其映射到Map。。。有没有办法创建自定义配置属性转换器

这是Eclipse文件问题吗?这是虫子吗?这是功能请求吗?:) 或者,还有其他/更好的方法吗

谢谢你的帮助


共 (0) 个答案