I would like to generate a list of my application configuration values, with their description and default values. Just like quarkus has for the framework itself on https://quarkus.io/guides/all-config, but for my application properties.
Would it be possible to achieve this using the SmallRye Config or Quarkus APIs?
Quarkus does not have an official support for this. This has been discussed, and there is even an issue to add it properly at some point: https://github.com/quarkusio/quarkus/issues/19020
At your own risk, you can add the quarkus-extension-processor to your project and annotate the mappings with #ConfigRoot(phase = ConfigPhase.RUN_TIME)(it still requires the #ConfigMapping), which will generate the adoc files used by Quarkus for its own configuration.
Related
I can run a Spring Boot application and then use the springdoc-openapi-maven-plugin artifact to generate an OpenAPI spec.
However, is there also a way to generate the spec without running the application first?
I currently want to generate the spec in a GitHub Action and a direct way would simplify this a lot.
you can use swagger editor: https://editor.swagger.io/
It allows you to write a json/yaml with your specifications and at the same time you can view the result.
Also, in the upper part there are 2 features, which allow you to generate the code based on the json/yaml made.
For example you can create a spring application with all the endpoints you go to specify in your json/yaml ( server).
But you can also generate HTML. (Client)
I have different profiles based on environment wise and needs to load it. How i can achieve and also how to pass program arguments for Quarkus main application to take dev profile(spring.config.location=classpath:/config/dev/application.yml)
Is there a way to load databse configuration while starting #QuarkusMain. I have configured all the database configurations into one class and how this class can be load in main. Please suggest on this.
Quarkus 1.13 (and later), supports profile aware application.properties. Just name your file application-{profile}.properties and activate it with -Dquarkus.profile={profile}
If you want to load specific files, you can also use quarkus.config.locations. This is backed by SmallRye Config. Please check additional documentation here: https://smallrye.io/docs/smallrye-config/main/config/config.html
I'm planning to run our own Spring Initializr instance. Is there a way to have a set of application properties get written (to application.yml) when a certain option is chosen, ideally in a separate section for each of a set of predefined profiles? I've looked into customising the project-generation process in Initializr and at creating a custom starter. I've come across auto-configuration for starters, but that seems to be about what configuration to default to when this has not been provided by properties, whereas I am after generating the properties. I've also come across an example of a custom Spring Initializr instance generating files, but I need it to modify application.yml without clobbering any other modifications that may have been made to it.
Spring Initializr (the library behind start.spring.io) does not have yaml support and does not allow you to write such file automatically when the project is generated.
It's easy enough for you to add that feature though. The way it works is through a model that contributors would tune + a writer that transform the model into the target output. An analogy of this would be MavenBuild and MavenBuildWriter that generates Maven's pom.xml.
Auto-configuration is indeed completely unrelated to code/configuration generation so no need to look there.
In Quarkus, We have properties file inside project itself called application.properties.
Is there any Quarkus way to define external properties file in my use case like i am developing a mail sender and i want to add recipients in future.
Is it possible to give application.properties outside at local and inject it at runtime?
You can add a configuration file in your application working directory under config/application.properties : https://quarkus.io/guides/config#overriding-properties-at-runtime
There is ongoing discussion to have more runtime configuration capabilities here: https://github.com/quarkusio/quarkus/issues/1218
You can achieve this by keeping .properties (or .yaml) in Spring Cloud Config Server.
It's really easy to set it up. It's is well documented in following link (official documentation):
Quarkus - Reading properties from Spring Cloud Config Server
As loïc says, you can follow the convention and create a config/application.properties. You can also use the property quarkus.config.locations to specify additional config locations. It can be defined at runtime like below
java -Dquarkus.config.locations=app-config/config.properties -jar my-app.jar
I am configuring Consul with SpringBoot and found a documentation here. Even browsed other resources, no more additional configs or scenarios found.
Therefore, I am curious whether only those configurations are available when springboot app is integrated with consul. I would like to deep dive and Can anyone let me know any other properties available ?
These are the properties available.
These are used in
org.springframework.cloud.consul.config.ConsulConfigProperties, org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.
Best place to see which property is being used where is to see AutoConfiguration of any module. For example for Mongo check MongoAutoConfiguration and MongoDataAutoConfiguration. Similarly, for consul check ConsulAutoConfiguration
This page will provide configuration properties
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
In addition, you can see the config properties in your IDE itself. If you are using IntelliJ or STS/Eclipse, go to application.yml file, you can view and see the configurations available by pressing Ctrl + space . It will give suggestions.