Describe the bug
When defining properties with kebab case and defining pojos in camel case, the properties are not binded. The preferred behavior would be like described here: Relaxed Binding
Expected behavior
I defined a property named:
prop.name-with-dash
and a class:
@Data
@ConfigurationProperties(prefix = "prop")
public class MyProps {
private String nameWithDash;
}
The property gets loaded correctly.
Actual behavior
The application fails with:
javax.enterprise.inject.spi.DeploymentException: No config value of type [java.lang.String] exists for: prop.nameWithDash
To Reproduce
The issue is pretty straightforward that's why I am not attaching a project, if really needed let me know and I will add one.
Configuration
# Add your application.properties here, if applicable.
prop.name-with-dash=value
Environment (please complete the following information):
uname -a or ver: Linux host 5.8.10-arch1-1 #1 SMP PREEMPT Thu, 17 Sep 2020 18:01:06 +0000 x86_64 GNU/Linuxjava -version: openjdk version "11.0.8" 2020-07-14mvnw --version or gradlew --version): Apache Maven 3.6.3 (NON-CANONICAL_2019-11-27T20:26:29Z_root)/cc @geoand
I don't think relaxed binding is possible, given properties names have to be known at build time...
The default for spring-boot extension should rather be kebab case given it's "recommended for use in .properties and .yml files" in the docs.
Maybe quarkus.arc.config-properties-default-naming-strategy could be used when needing to switch to camelCase/verbatim ?
The limitation of not mixing strategies would have to be documented.
There's no strategy in Quarkus for "underscore notation", but I doubt it's used a lot.
Fair enough about relaxed binding but then would be great letting the user decide which kind of binding to use. I don't think quarkus.arc.config-properties-default-naming-strategy is used in this case since the default is kebab-case and it is using the exact name of the property to bind.
I agree we should change to kebab case for this extension and document the
limitations.
cc @gytis
On Sat, Oct 3, 2020, 12:59 Ivan Gregurić Ortolan notifications@github.com
wrote:
Fair enough about relaxed binding but then would be great letting the user
decide which kind of binding to use. I don't think
quarkus.arc.config-properties-default-naming-strategy is used in this
case since the default is kebab-case and it is using the exact name of the
property to bind.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/quarkusio/quarkus/issues/12483#issuecomment-703078945,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABBMDPYLV27D546JAKMC6LLSI3YWVANCNFSM4SB3W4IA
.
Makes sense. I'll fix it.
Most helpful comment
Makes sense. I'll fix it.