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 disabling of datasources by excluding packages #1323

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Conversation

timyates
Copy link
Contributor

This allows the testing of non-db beans without requiring the connection pools to be fully configured.

Does not cover r2dbc as that is defined elsewhere.

micronaut-projects/micronaut-data#2893

It is done this way (with package requirements) as there is no way currently to allow EachBean to skip factory creation based on a property of the bean (ie Toggleable#isEnabled).

This allows the testing of non-db beans without requiring the connection pools to be fully configured.

Does not cover r2dbc as that is defined elsewhere.

micronaut-projects/micronaut-data#2893

It is done this way (with package requirements) as there is no way currently to allow EachBean to skip factory creation based on a property of the bean (ie Toggleable#isEnabled).
@timyates timyates added the type: enhancement New feature or request label Apr 24, 2024
@timyates timyates added this to the 5.7.0 milestone Apr 24, 2024
@timyates timyates requested review from dstepanov and sdelamo April 24, 2024 11:28
@timyates timyates self-assigned this Apr 24, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@@ -18,8 +18,11 @@
*/
@Configuration
@Requires(classes = HikariDataSource.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add requires to BasicJdbcConfiguration and that should be enough for all implementations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dstepanov No, the @Requires doesn't seem to carry through... In my tests with Hikari, we still end up with a DatasourceConfiguration and a HikariUrlDataSource bean

@sdelamo sdelamo requested a review from dstepanov April 25, 2024 05:01
@sdelamo sdelamo merged commit b1bad14 into 5.7.x Apr 26, 2024
41 checks passed
@sdelamo sdelamo deleted the allow-disabling branch April 26, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants