code.quarkus.io
code.quarkus.io copied to clipboard
Add default properties in application.properties when creating a new project
I'm not sure if this is the right place for this issue, but let me know otherwise.
When I create a new project and include the Hibernate Reactive extension using the start with quarkus page, the created application.properties is empty. This is a bit annoying because now I have to go and look in the documentation for the most common properties that i need.
I think it would be nice to have at least some properties related to the extensions I've selected. They can just be commented.
For example, for Hibernate Reactive, I would like to have an application.properties similar to this out-of-the-box:
#%prod.quarkus.datasource.db-kind=postgresql
#%prod.quarkus.datasource.username=quarkus_test
#%prod.quarkus.datasource.password=quarkus_test
#quarkus.hibernate-orm.database.generation=drop-and-create
#quarkus.hibernate-orm.sql-load-script=import.sql
# Log SQL queries
quarkus.hibernate-orm.log.sql=false
# Format SQL query when logged
quarkus-hibernate-orm_quarkus.hibernate-orm.log.format-sql=true
# Reactive config
#%prod.quarkus.datasource.reactive.url=vertx-reactive:postgresql://localhost/quarkus_test
My most common scenario is figure out which properties to set for logging. But in case of Hibernate, it's also nice to have the properties about the creation of the schema and datasource configuration.
I haven't checked all the extensions, maybe this is something that's already done somewhere else.
We don't add them as part of the default project, there is a simple reason, better have awesome tools to solve this rather than polluting the initial project:
- The Dev UI: http://localhost:8080/q/dev-ui/
- The Quarkus Tools plugin for IDEs https://quarkus.io/guides/ide-tooling:
BTW @angelozerr the current implementation for application.properties has 2 issues:
- it doesn't work with Quarkiverse extensions (or maybe I need to do something from the extension that I don't know, in case we should warn people about this)
- it would be nice to show the doc for the suggested configuration parameters
it doesn't work with Quarkiverse extensions (or maybe I need to do something from the extension that I don't know, in case we should warn people about this)
It should except if some properties are hard coded. Please create an inssue on IJ Quarkus to explain which properties are missing and give us a link with a sample project, thanks!
it would be nice to show the doc for the suggested configuration parameters
I have implemented this feature and it should work but you need to activate Show documentation completion popiup,
see my comment at https://github.com/redhat-developer/intellij-quarkus/pull/1115#issuecomment-1685407264 and you should see
@DavideD I think your need is to have code snippet. We provide today code snippets by using the file https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-properties.json
You should have qds
or qj
which are available according your Quarkus dependency and generate a code snippet. For your case of hibernate, I suggest that you create a PR to add your hibernate code snippet in https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-properties.json
This JSON file belong to the Quarkus language server extension which is integrated in vscode, Eclipse IDE or IJ.
We don't add them as part of the default project, there is a simple reason, better have awesome tools to solve this rather than polluting the initial project:
Maybe I'm the only one that creates projects for demo, prototyping or just playing around.
But I don't understand why one cannot have both. You could add a checkbox for it: Add common properties to application.properties
. Plus, you could include in it how to access the dev UI for more properties.
The dev UI is nice, but editing a text file is much faster and can be done without starting quarkus first. And not everybody uses the IDE extension for Quarkus.
Maybe my suggestion is not going to work for every extensions, but for Hibernate ORM or Reactive, one pretty much always has to add the right connection url and needs to know how to enable logs.
Anyway, this is not a hill I'm willing to die on. It's too tied to personal experience and I don't plan to work on it anyway. If you guys don't think it's something helpful, feel free to close the issue.
And not everybody uses the IDE extension for Quarkus.
Which IDE/Editor are you using? If you use vscode, Eclipse IDE or IJ you will have this Quarkus / Qute support. Do you use it?
I use vanilla IntelliJ community edition. Frankly, to implement what you are suggesting, I would have to do extra research (I don't know what code snippets are or how they work). Editing a properties file feels easier (as a noob).
By the way, when I've create this issue, I was thinking about code.quarkus.io. I didn't have any IDE or tools in mind.
FYI one other simple reason/issue is that we are using application.yml
for codestarts definition (and comments are not kept jackson yaml :-/)
I do agree that if a config is important in 90% of created apps, then having it commented out could make sense.
OK, I haven't thought about the YAML configuration. In that case, I would disable the feature, or set the default value for the properties without comments. Still pretty helpful IMHO