java—如何使用helm3将整数值部署到spring引导应用程序?

ux6nzvsh  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(239)

我们正在使用helm3将spring-boot应用程序部署到k8s集群。
我们使用helm values.yaml文件传递环境变量,但我发现我们可以发送整数值,它应该始终是字符串格式。
由于@configuration未能将字符串值Map为整数,我只想知道如何在spring boot应用程序中实现这一点。
我做了下面这样的事情,这对我很有效,但我只想知道这是正确的方法吗?

public void setValue(String value) {
        this.value = Integer.valueOf(value);
 }

我希望下面的代码可以很好地与赫尔姆部署

@Configuration
@Getter //Another problem is i am not able to use the feature of lombok because of this
@Setter
@ConfigurationProperties("initializer.service")
public class InitializerPropertyConfig {
    private Integer value;
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题