Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow converting YAML application configuration to property format at build time #9964

Closed
auke- opened this issue Oct 11, 2023 · 4 comments
Closed

Comments

@auke-
Copy link
Contributor

auke- commented Oct 11, 2023

Feature description

Since Micronaut 4 the default way to define application configuration is the property file format, which allowed removing the YAML dependencies from Micronaut projects. It is however easier to define the configuration in the YAML format.

It would be nice if Micronaut allowed defining application configuration in YAML and automatically convert it to the property file when building/packaging the application (e.g. using the Micronaut AOT plugin). This wouldn't support loading YAML at runtime but makes defining the application configuration easier (the generated YAML could include a comment describing this limitation).

One aspect to consider is whether or not this should be enabled by default. In my opinion this would improve the developer experience when creating new projects.

@kevind-wgu
Copy link

kevind-wgu commented Oct 12, 2023

If you import snakeyaml into your pom then it will load application.yml automatically.

@auke-
Copy link
Contributor Author

auke- commented Oct 12, 2023

If you import snakeyaml into your pom then it will load application.yml automatically.

I know. As of Micronaut 4 snakeyaml isn't added by default, I suppose in order to make the resulting application a bit leaner. For developer experience it would be nice to support yaml at build time without having the runtime dependency on snakeyaml

@graemerocher
Copy link
Contributor

this is actually possible already with Micronaut AOT. See https://micronaut-projects.github.io/micronaut-gradle-plugin/latest/#_micronaut_aot_plugin and convertYamlToJava = true

@auke-
Copy link
Contributor Author

auke- commented Oct 14, 2023

You guys keep surprising me and keep over delivering :)

I've create micronaut-projects/micronaut-starter#2131 as a proposal to make the instructions a bit more clear.

@auke- auke- closed this as completed Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants