Skip to content

Add a new components to CDI. #298

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

Merged
merged 6 commits into from
Mar 2, 2025
Merged

Add a new components to CDI. #298

merged 6 commits into from
Mar 2, 2025

Conversation

orekyuu
Copy link
Contributor

@orekyuu orekyuu commented Jan 25, 2025

The following components added to Doma2 will be managed by CDI.

Class Default value
DuplicateColumnHandler ConfigSupport.defaultDuplicateColumnHandler
SqlBuilderSettings ConfigSupport.defaultSqlBuilderSettings
StatisticManager ConfigSupport.defaultStatisticManager

Add new configuration property:

property default description
quarkus.doma.throw-exception-if-duplicate-column false When set to true, ThrowingDuplicateColumnHandler will be registered in CDI.When set to false, ConfigSupport.defaultDuplicateColumnHandler will be used.
quarkus.doma.sql-builder-settings.should-require-in-list-padding false
quarkus.doma.sql-builder-settings.should-remove-blank-lines false

If DuplicateColumnHandler or SqlBuilderSettings is registered in CDI, these properties will be ignored.

@orekyuu orekyuu requested a review from nakamura-to January 25, 2025 08:45
@orekyuu orekyuu requested a review from a team as a code owner January 25, 2025 08:45
@orekyuu orekyuu marked this pull request as draft January 25, 2025 08:55
@nakamura-to
Copy link
Member

Thanks. LGTM

@orekyuu orekyuu force-pushed the add-new-components-to-cdi branch from c23d2c0 to c7decfd Compare February 2, 2025 02:21
@orekyuu orekyuu force-pushed the add-new-components-to-cdi branch from c7decfd to 884c08e Compare February 2, 2025 02:34
@orekyuu orekyuu marked this pull request as ready for review February 2, 2025 02:47
Copy link
Member

@nakamura-to nakamura-to left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
I made a minor suggestion.

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use *.

@orekyuu orekyuu requested a review from nakamura-to February 18, 2025 12:20
@orekyuu orekyuu force-pushed the add-new-components-to-cdi branch from b704291 to 3f5da36 Compare February 18, 2025 12:34
# Conflicts:
#	deployment/src/main/java/io/quarkiverse/doma/deployment/DomaBuildTimeConfig.java
Copy link
Member

@nakamura-to nakamura-to left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few minor comments.
I'll approve it

Comment on lines +340 to +342
this.duplicateColumnHandler = duplicateColumnHandler;
this.sqlBuilderSettings = sqlBuilderSettings;
this.statisticManager = statisticManager;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to have null checks for the following parameters, just like the other parameters.

  • duplicateColumnHandler
  • sqlBuilderSettings
  • statisticManager

@@ -115,4 +126,25 @@ public interface DataSourceBuildTimeConfig {
@ConfigDocDefault("import.sql in DEV, TEST ; no-file otherwise")
Optional<String> sqlLoadScript();
}

@ConfigGroup
public interface SqlBuilderBuildTimeConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SqlBuilderSettingsBuildTimeConfig might be a more consistent name, though it is somewhat redundant.

@Singleton
@DefaultBean
DuplicateColumnHandler duplicateColumnHandler() {
return duplicateColumnHandler;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better to have a null check to align with other parts.

@nakamura-to
Copy link
Member

In the Pull Request description, should sql-builder-settings.should-remove-blank-lines actually be quarkus.doma.sql-builder-settings.should-remove-blank-lines?

@orekyuu orekyuu merged commit 96fdc4a into master Mar 2, 2025
1 check passed
@orekyuu orekyuu deleted the add-new-components-to-cdi branch March 2, 2025 06:55
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

Successfully merging this pull request may close these issues.

2 participants