Skip to content

Support auto-configuration of a DataSource without spring-jdbc on the classpath #43786

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

Closed
mdeinum opened this issue Jan 13, 2025 · 1 comment
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@mdeinum
Copy link
Contributor

mdeinum commented Jan 13, 2025

While answering a question on stackoverflow where a user tries to use the Spring Boot Auto Configured datasource with Oracle AQJMS it initially didn't work. This was due to an Oracle auto configuration class creating the datasource and happily ignore all the other properties being set.

Excluding the auto-configuration initially appeared to be working in my small solution, it did not however work for the topic starter. Upon further inspection the Spring Boot DataSourceAutoConfiguration only works when spring-jdbc is on the classpath. This is due to the @ConditionalOnClass({ DataSource.class, EmbeddedDatabaseType.class }) on said class.

Just wondering if that was intentional (it appears to as that has been the case since day 1 I think) or should be revised. Auto datasource configuration without spring-jdbc can be useful if you want to use messaging features like Oracle AQJMS or Postgres listeners but require no other JDBC data access.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 13, 2025
@wilkinsona wilkinsona changed the title DataSourceAutoConfiguration only works with spring-jdbc on the classpath. Support auto-configuration of a DataSource with spring-jdbc on the classpath Jan 13, 2025
@wilkinsona wilkinsona changed the title Support auto-configuration of a DataSource with spring-jdbc on the classpath Support auto-configuration of a DataSource without spring-jdbc on the classpath Jan 13, 2025
@wilkinsona wilkinsona added the for: team-meeting An issue we'd like to discuss as a team to make progress label Jan 13, 2025
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Feb 12, 2025
@philwebb philwebb added this to the 3.5.x milestone Feb 12, 2025
@philwebb
Copy link
Member

We think this might be possible to do in 3.5, although we need to update our DataSourceBuilder class to make sure it doesn't reference spring-jdbc imports. We think this should be possible since none of those types are in method signatures.

@wilkinsona wilkinsona self-assigned this Mar 10, 2025
@wilkinsona wilkinsona modified the milestones: 3.5.x, 3.5.0-M3 Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants