繁体   English   中英

SpringBoot 2迁移ConfigurationProperties无法将属性绑定到String []

[英]SpringBoot 2 migration ConfigurationProperties Failed to bind property to String[]

我只是从Spring Boot 1.5.8迁移到2.0.0

我解决了大多数迁移错误,但是对此我一无所知:

@Configuration
public class LdapConfiguration {

    @Bean
    @ConfigurationProperties(prefix = "ldap")
    public LdapContextSource contextSource() {
        return new LdapContextSource();
    }

    @Bean(name = "ldapTemplate")
    public LdapTemplate ldapTemplate(ContextSource contextSource) {
        return new LdapTemplate(contextSource);
    }
}

我的自定义值(所有变量均为var env属性,这就是分隔符为“ _”的原因):

LDAP_URLS=ldaps://ldap-url.com:636/

错误:

Description:

Failed to bind properties under 'ldap.urls' to java.lang.String[]:

    Reason: Unable to get value for property urls

Action:

Update your application's configuration

似乎无法将我的字符串值ldap.urls绑定到String [],我尝试用逗号分隔属性中的2个值。

任何想法 ?

由于某种原因,Spring Boot无法绑定到克隆的阵列。 我提出了#12478,因为我相信这是2.0中新资料夹的回归。

编辑:自Spring Boot 2.0.1起已修复

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM