question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spring-cloud-starter-config causes config bean validation to fail

See original GitHub issue

Spring boot 1.5.2 fails to start because of bean validation errors caused by spring-cloud-config-starter:Camden.SR5.

We have a couple of @ConfigurationProperties in our project - some of properties to be set are coming from a defaults.properties in the classpath and others are overwritten by a config provided by a config server. Since we upgraded to boot:1.5.2 and spring-cloud:Camden.SR5 our app does not start properly anymore because of a bean validation error like the following:

Binding to target com.example.config.MiscConfigInfo@6f6962ba failed:

    Property: misc.kmsToWarning
    Value: null
    Reason: may not be empty

    Property: misc.listener
    Value: null
    Reason: may not be null

Action:

Update your application's configuration

So far so good, the description seems very clear, but it actually is wrong - the configuration is all fine and it works as soon as we remove spring-cloud-config-starter from the classpath.

Here is a very small project demonstrating the issue: https://github.com/imod/spring-config-validation-issue

For now, there only seems one workaround: we have to disable the field validation (remove the annotations on the properties).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dsyercommented, Mar 6, 2017

It’s fixed in snapshots (Camden and Dalston). New releases are coming shortly. Probably this change: https://github.com/spring-cloud/spring-cloud-commons/commit/8347c5741c3100a5f941db32f43f5088bb54bad5

0reactions
imodcommented, Mar 7, 2017

done: #663

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to create a Configuration, because no Bean Validation ...
boot:spring-boot-starter-validation has following dependencies, which are org.glassfish:jakarta.el and org.hibernate.validator:hibernate-validator . Then, org.
Read more >
Validate Spring Boot Configuration Parameters at Startup
For some configuration parameters it makes sense to fail application startup if they're invalid. Spring Boot offers us a neat way of validating ......
Read more >
Validation in Spring Boot - Baeldung
Learn how to validate domain objects in Spring Boot using Hibernate Validator, the reference implementation of the Bean Validation framework.
Read more >
How to use Java Bean Validation in Spring Boot | Nullbeans
If your project inherits from the “spring-boot-starter-parent” module, then you can omit the version numbers from the dependency declarations.
Read more >
Validations with @ConfigurationProperties in Spring Boot
The application YAML and Properties files contain the application level configurations and variables. Thus it is important to validate the Configuration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found