These are chat archives for spring-cloud/spring-cloud

3rd
Feb 2018
nonysingh79
@nonysingh79
Feb 03 2018 03:31
@spencergibb : Thanks for advice. I found out that my Spring boot maven plugin was adding a qualifier to the jar thus it was getting renamed.
Viktor Gal
@vigsterkr
Feb 03 2018 14:07

Say i have a List<AbstractClass> list specified. i wonder if it would be possible that spring creates/loads that list with different type of extensions of AbstractClass based on a property value in the property file.
say my property file is:
list[0].name = "classname1"
list[0].x = "1"
list[0].y = "1"
list[1].name = "classname2"
list[1].x = "100"
list[1].y = "100"

and i'd like to have a list the list to be = [classname1, classname2] based on the properties above

i'm wondering if @ConditionalOnProperty could be used for these purposes
Viktor Gal
@vigsterkr
Feb 03 2018 14:31
the problem is that ConditionalOnProperty requires the full path of the property name... whereas this one is nested
Dave Syer
@dsyer
Feb 03 2018 14:33
There's no way to do that with @ConfigurationProperties. Sorry.
Viktor Gal
@vigsterkr
Feb 03 2018 15:15
@dsyer so there's no way i can dynamically instantiate objects in a list? dynamic = their type is being set/specified in the properties file itself
Israel Fernández
@iferca
Feb 03 2018 16:48

I’m playing with spring-boot-2.RC1 and migrated one of my services that depends on spring-cloud-vault, when I execute it I get this error:

Description:

Failed to bind properties under 'spring.cloud.vault.ssl' to org.springframework.cloud.vault.config.VaultProperties$Ssl:

    Reason: HV000030: No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.String'. Check configuration for 'certAuthPath'

Action:

Update your application's configuration

This started happening when I migrated the version, app work fine with 1.5.10. My vault configuration looks like this in bootstrap.properties:

spring.cloud.vault.host=security.services.vault
spring.cloud.vault.port=443
spring.cloud.vault.authentication=APPROLE
spring.cloud.vault.app-role.role-id=${VAULT_ROLE_ID}
spring.cloud.vault.app-role.secret-id=${VAULT_SECRET_ID}
spring.cloud.vault.generic.enabled=false

I’d appreciate any hint or reference to a spring - vault migration guide maybe?

last part of stack trace looks like this:
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.cloud.vault.ssl' to org.springframework.cloud.vault.config.VaultProperties$Ssl
    at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:227) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:203) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$4(Binder.java:313) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    ..
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_162]
    at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) ~[na:1.8.0_162]
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_162]
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) ~[na:1.8.0_162]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:1.8.0_162]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_162]
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_162]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_162]
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) ~[na:1.8.0_162]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$6(Binder.java:322) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:415) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:405) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:319) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:261) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:198) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:187) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:169) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:79) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:167) ~[spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    ... 49 common frames omitted
Caused by: javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.String'. Check configuration for 'certAuthPath'
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.throwExceptionForNullValidator(ConstraintTree.java:227) ~[hibernate-validator-5.4.0.Final.jar:5.4.0.Final]
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorNoUnwrapping(ConstraintTree.java:308) ~[hibernate-validator-5.4.0.Final.jar:5.4.0.Final]
    at org.hibernate.validator.internal.engine.con
Spencer Gibb
@spencergibb
Feb 03 2018 22:33
Add spring-boot-starter-validation?
Israel Fernández
@iferca
Feb 03 2018 23:23
@spencergibb Thank, that seems to work, at least getting different error message now.
Getting an error decrypting some cyphered VAULT_SECRET, setup pf the app is the same as before upgrading to spring.boot 2:
java.lang.IllegalStateException: Cannot decrypt: key=VC_VAULT_SECRET_ID
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:202) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:166) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.initialize(EnvironmentDecryptApplicationInitializer.java:96) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener$DelegatingEnvironmentDecryptApplicationInitializer.initialize(BootstrapApplicationListener.java:409) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:366) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1]
    at com.monsanto.finance.vceventstoreevents3exporter.ApplicationKt.main(Application.kt:50) [classes/:na]
Caused by: java.lang.UnsupportedOperationException: No decryption for FailsafeTextEncryptor. Did you configure the keystore correctly?
    at org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$FailsafeTextEncryptor.decrypt(EncryptionBootstrapConfiguration.java:158) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:194) ~[spring-cloud-context-2.0.0.M5.jar:2.0.0.M5]
    ... 9 common frames omitted
I’m passing -DENCRYPT_KEY=….. as argument to the app