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

Enhance spring.datasource.initialization-mode property description #21121

Closed
nikmanzotti opened this issue Apr 25, 2020 · 3 comments
Closed

Enhance spring.datasource.initialization-mode property description #21121

nikmanzotti opened this issue Apr 25, 2020 · 3 comments
Labels
type: documentation A documentation update
Milestone

Comments

@nikmanzotti
Copy link
Contributor

nikmanzotti commented Apr 25, 2020

As discussed here #20920 and here #21077 with @snicoll, we think that the description may of the spring.datasource.initialization-mode could be improved.

I understand that the description is generated from the code comment, which states:

Initialize the datasource with available DDL and DML scripts.

In the current docs dedicated section, the description field is empty (I've opened another issue for this specific problem, see #21131).

I have reviewed my initial enhancement proposal after viewing the original description and receiving some feedback.

I've done some research, in the Spring Framework documentation they use "DataSource implementations" and "Database types" to refer to the actual DBMS (e.g. H2, Derby, HSQL - see 3.2. Package Hierarchy, 3.9. Embedded Database Support). I suppose it's a wording valid for both embedded and "non-embedded" databases, so not suitable for the values of the spring.datasource.initialization-mode property.

Updated proposal:

Initialize the embedded datasource with available DDL and DML scripts. Use always to initialize any datasource.

This avoids the use of "type of datasource", and describes the usage of always as a value, but I'm still not sure if is it clearly understandable.

Also, I was guessing: is there a way to disable datasource initialization, even if the DDL and DML scripts are present?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 25, 2020
@nikmanzotti nikmanzotti changed the title Fix/enhance spring.datasource.initialization-mode property description Enhance spring.datasource.initialization-mode property description Apr 26, 2020
@snicoll
Copy link
Member

snicoll commented Apr 26, 2020

Initialize the embedded datasource with available DDL and DML scripts. Use always to initialize any datasource.

Thanks for the suggestion. I don't like this proposal as it is documented towards its default value.

Also, I was guessing: is there a way to disable datasource initialization, even if the DDL and DML scripts are present?

This question probably explains why you are raising this issue in the first place. The three values for that property are documented. never can be used to not initialize the database.

I think rather than being imperative about the fact the datasource is going to be initialized, we should update the description to focus that this controls the "mode" of initialization.

@snicoll snicoll added the for: team-attention An issue we'd like other members of the team to review label Apr 26, 2020
@nikmanzotti
Copy link
Contributor Author

Thanks for the feedback! You are right, I am quite new to Spring Boot (to the whole programming world, actually) and I have still many things to understand and learn.

Being the description related only to the default value, I agree with you. This is an updated proposal, but I am still not sure it makes things clear enough:

If the datasource is an embedded one, initialize it with available DDL and DML scripts.


P.S. do you think it would be worth adding a Note block (or something else) to explain where the complete documentation of the properties and their values could be found? It would be aimed mostly at beginners, and I am not sure it is something easy to generalize. For instance, I can see comments for LiquibaseProperties attributes looking at the Java code, but I wasn't able to find them in the class Javadoc.

@snicoll
Copy link
Member

snicoll commented Apr 27, 2020

Being the description related only to the default value, I agree with you. This is an updated proposal, but I am still not sure it makes things clear enough:

If the datasource is an embedded one, initialize it with available DDL and DML scripts.

Thanks for the feedback but that's still a description towards its default value. If you set the value of this property to always or never the description reads completely wrong to me.

P.S. do you think it would be worth adding a Note block

Let's not start two different topics in one issue please as it makes it very hard to understand what is going on. Feel free to join the community on Gitter if you want to chat about an idea or create a separate issue.

Having said that, descriptions are available in your IDE and in the appendix of the reference guide. I would argue that ConfigurationProperties is not what you should look at to learn about a feature as it is a relatively low-level part and internal to the framework. Discovering properties by typing liquibase in your IDE or searching in the reference documentation is what I would expect a beginner to do.

@philwebb philwebb added type: documentation A documentation update and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels May 27, 2020
@philwebb philwebb modified the milestones: 2.1.x, 2.2.x May 27, 2020
@wilkinsona wilkinsona modified the milestones: 2.2.x, 2.2.12 Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

5 participants