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
This works perfectly fine on micronaut 4.7.6, but fails to initialize on 4.8.0 with:
Message: Validation failed for bean definition [com.github.bfg.mn48.ControllerCfg]
List of constraint violations:[
com.github.bfg.mn48.ControllerCfg.apiBase - must not be blank
]
Path Taken:
new c.g.b.m.Controller(ControllerCfg cfg)
\---> new c.g.b.m.Controller([ControllerCfg cfg])
\---> new @i.m.c.a.ConfigurationProperties("app.controller") c.g.b.m.ControllerCfg(boolean enabled, [String apiBase], String something)
It's obvious that apiBase property default value is not applied if it's absent in the config file. I really like and prefer 4.7.x behaviour in this context because some configuration constructs can be only easily specified in the code and have to be rarely changed in the actual config.
Expected Behavior
Assuming that you have configuration data class that is validated during initialization:
application configuration
application.conf
containing the following:This works perfectly fine on micronaut
4.7.6
, but fails to initialize on4.8.0
with:It's obvious that
apiBase
property default value is not applied if it's absent in the config file. I really like and prefer4.7.x
behaviour in this context because some configuration constructs can be only easily specified in the code and have to be rarely changed in the actual config.Actual Behaviour
Exception is being thrown
Steps To Reproduce
Reproducer: https://github.com/bfg/mn-48-kotlin-data-class-defvalue
Environment Information
Example Application
https://github.com/bfg/mn-48-kotlin-data-class-defvalue
Version
4.8.0
The text was updated successfully, but these errors were encountered: