You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my Kotlin application, I have a set of feature flags. However these flags are not globally set but may different for certain business and functions and should be configured using the application.yml. My yml looks something like this:
I want to bind them using @ConfigurationProperties and built the following:
@ConfigurationProperties("app.flags")
classFeatureFlagSettings {
var function1:FeatureFlagPropertiesvar function2:FeatureFlagPropertiesvar function3:FeatureFlagProperties
}
classFeatureFlagProperties {
var flag1:Booleanvar flag2:Booleanvar flag3:Boolean
}
But I quickly realized, that the properties are not properly set. Apparently this is way of building properties only works for Java but not Kotlin. Of course I could simply copy and paste the FeatureFlagProperties class for each function with it's own class name and @ConfigurationProperties but that seems not like the proper way of doing things.
Is there a way to use @ConfigurationProperties and reuse a class with reocurring properties? I know there is the @EachProperty annotation but my use case is for predefined properties, not a generic collection of entries.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In my Kotlin application, I have a set of feature flags. However these flags are not globally set but may different for certain business and functions and should be configured using the
application.yml
. My yml looks something like this:I want to bind them using
@ConfigurationProperties
and built the following:But I quickly realized, that the properties are not properly set. Apparently this is way of building properties only works for Java but not Kotlin. Of course I could simply copy and paste the
FeatureFlagProperties
class for each function with it's own class name and@ConfigurationProperties
but that seems not like the proper way of doing things.Is there a way to use
@ConfigurationProperties
and reuse a class with reocurring properties? I know there is the@EachProperty
annotation but my use case is for predefined properties, not a generic collection of entries.Beta Was this translation helpful? Give feedback.
All reactions